@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
    --bg: #f4f7fb;
    --surface: rgba(255, 255, 255, .94);
    --surface-strong: #ffffff;
    --ink: #172033;
    --muted: #68758a;
    --line: #e4eaf2;
    --primary: #155eef;
    --primary-2: #0b4bc4;
    --accent: #13b8a6;
    --danger: #d92d20;
    --success: #079455;
    --warning: #f79009;
    --shadow-sm: 0 4px 16px rgba(19, 35, 67, .06);
    --shadow-md: 0 14px 40px rgba(19, 35, 67, .10);
    --shadow-lg: 0 24px 70px rgba(19, 35, 67, .14);
    --radius: 16px;
    --radius-sm: 10px;
    --container: 1220px;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 0%, rgba(21,94,239,.09), transparent 28rem),
        radial-gradient(circle at 95% 12%, rgba(19,184,166,.08), transparent 24rem),
        var(--bg);
    font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(21,94,239,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(21,94,239,.018) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.header {
    position: sticky;
    top: 0;
    z-index: 50;

    min-height: 74px;
    padding: 12px max(24px, calc((100vw - var(--container)) / 2));

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    color: #fff;
    background: linear-gradient(
        115deg,
        #0b1730 0%,
        #102b5f 54%,
        #155eef 150%
    );

    border-bottom: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 10px 30px rgba(8, 22, 48, .16);
}

.header::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(19,184,166,.7),
        transparent
    );
}

.header-title {
    grid-column: 1;
    justify-self: start;
}

.header-title::before {
    content: "";
    display: block;

    width: 170px;
    height: 65px;

    background-image: url("/static/images/med.png");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;

    flex-shrink: 0;
}

.header-center {
    grid-column: 2;

    justify-self: center;

    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.2px;
    line-height: 1;

    white-space: nowrap;
}

.header-right {
    grid-column: 3;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    margin: 0;
    padding: 0;
}

.username, .header-user {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 8px 11px;
    color: rgba(255,255,255,.86);
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.logout, .header-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    color: #fff;
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    transition: .2s ease;
}

.logout:hover, .header-logout:hover { background: rgba(255,255,255,.17); transform: translateY(-1px); }

.admin-icon, .header-link {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: #fff;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    transition: .2s ease;
}
.admin-icon:hover, .header-link:hover { background: rgba(255,255,255,.17); transform: translateY(-1px); }

.header-subtitle {
    display: block;
    margin-top: 1px;
    color: rgba(255,255,255,.58);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .02em;
}

.header-logo { max-height: 34px; width: auto; object-fit: contain; }

.container, .admin-content {
    width: min(100% - 40px, var(--container));
    margin: 0 auto;
    padding: 42px 0 56px;
}

.page-container { min-height: 100vh; }

.page-title, .admin-page-intro h1 {
    margin: 0;
    color: #101828;
    font-size: clamp(27px, 3vw, 36px);
    line-height: 1.15;
    letter-spacing: -.04em;
    font-weight: 700;
}

.page-description, .admin-page-intro p {
    margin: 9px 0 28px;
    color: var(--muted);
    font-size: 14px;
}

.page-title + .page-description { margin-bottom: 28px; }

strong { color: #344054; }

.card, .admin-card, .empty {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(224,231,240,.95);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.card::before, .admin-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: .9;
}

.info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}

.info-item {
    min-width: 190px;
    padding: 13px 16px;
    background: rgba(255,255,255,.82);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(19,35,67,.035);
}

.info-label { display: block; margin-bottom: 3px; color: #98a2b3; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.info-value { color: #0b4bc4; font-size: 14px; font-weight: 700; }

.table-wrapper, .admin-table-wrapper { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }

thead th {
    padding: 14px 18px;
    color: #667085;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .075em;
    white-space: nowrap;
}

thead th:first-child { padding-left: 22px; }
tbody td {
    padding: 12px 12px;
    color: #344054;
    background: rgba(255,255,255,.72);
    border-bottom: 1px solid #edf1f5;
    font-size: 14px;
    vertical-align: middle;
}

tbody td:first-child { padding-left: 22px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .18s ease, transform .18s ease; }
tbody tr:hover td { background: #f8fbff; }

.tender-number, .reference-number { color: var(--primary); font-weight: 700; white-space: nowrap; }
.stock-code { color: #475467; font-family: "SFMono-Regular", Consolas, monospace; font-size: 15px; font-weight: 500; white-space: nowrap; }
.stock-name { color: #344054; }
.unit { color: #667085; font-weight: 500; white-space: nowrap; text-align: center; }

/* Order table */
.order-table { table-layout: fixed; }
.order-table th:nth-child(1), .order-table td:nth-child(1) { width: 18%; !important}
.order-table th:nth-child(2), .order-table td:nth-child(2) { width: 80%; !important}
.order-table th:nth-child(3), .order-table td:nth-child(3) { width: 80px; !important}
.order-table th:nth-child(4), .order-table td:nth-child(4) { width: 80px; !important}
.order-table td.stock-code, .order-table td.stock-name, .order-table td.unit td.kurum-adi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } 

.btn, .admin-primary-button, .admin-action-button, .admin-delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.btn:hover, .admin-primary-button:hover, .admin-action-button:hover, .admin-delete-button:hover { transform: translateY(-1px); }

.btn-primary, .admin-primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #1047b8);
    box-shadow: 0 8px 20px rgba(21,94,239,.2);
}
.btn-primary:hover, .admin-primary-button:hover { box-shadow: 0 11px 25px rgba(21,94,239,.27); }
.btn-secondary {
    color: #344054;
    background: #fff;
    border-color: #d9e0ea;
}
.btn-secondary:hover { background: #f8fafc; border-color: #c8d2df; }
.btn-danger {
    color: #b42318;
    background: #fff;
    border-color: #f1c8c5;
}
.btn-danger:hover { background: #fff5f4; border-color: #e8aaa5; }
.btn-large { min-height: 46px; padding: 11px 20px; font-size: 14px; border-radius: 11px; }

.form-group, .admin-form-group { margin-bottom: 18px; }
.form-label, .admin-form-group label {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.form-input, .admin-form-group input {
    width: 100%;
    height: 44px;
    padding: 9px 13px;
    color: #101828;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    outline: none;
    transition: border .18s ease, box-shadow .18s ease, transform .18s ease;
}
.form-input::placeholder, .admin-form-group input::placeholder { color: #98a2b3; }
.form-input:focus, .admin-form-group input:focus, .quantity-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21,94,239,.10);
}

.quantity-input {
    display: block;
    width: 100px;
    height: 40px;
    padding: 7px 10px;
    color: #101828;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    text-align: right;
    outline: none;
    font-weight: 600;
    transition: .18s ease;
}
.quantity-input::placeholder { color: #b1bac7; }

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    vertical-align: middle;
}

.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
}
.action-right { display: flex; align-items: center; gap: 10px; }

.order-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 18px;
    padding: 12px 15px;
    background: rgba(255,255,255,.7);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.order-status { display: flex; align-items: center; gap: 9px; color: #344054; font-size: 13px; font-weight: 600; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 5px rgba(18,183,106,.10); }
.order-hint { color: #98a2b3; font-size: 12px; }

.product-section { margin-bottom: 20px; }
.product-section:last-of-type { margin-bottom: 0; }
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 18px;
}
.section-kicker { color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.section-title { margin: 3px 0 0; color: #101828; font-size: 19px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.section-count {
    flex: 0 0 auto;
    padding: 6px 10px;
    color: #475467;
    background: #f2f4f7;
    border: 1px solid #e4e7ec;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.alert {
    margin-bottom: 20px;
    padding: 12px 15px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
}
.alert-error { color: #912018; background: #fef3f2; border: 1px solid #fecdca; }
.alert-success { color: #05603a; background: #ecfdf3; border: 1px solid #abefc6; }
.alert-info { color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; }

.empty { padding: 64px 28px; text-align: center; }
.empty::after { content: "⌁"; display: block; margin-top: 10px; color: #b6c2d2; font-size: 24px; }
.empty-title { margin-bottom: 5px; color: #344054; font-size: 18px; font-weight: 700; }
.empty-text { color: #98a2b3; font-size: 13px; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    position: relative;
}

.login-page::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(21,94,239,.15), transparent 65%);
    filter: blur(4px);
    top: -170px;
    right: -130px;
}

.login-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 450px;
    padding: 38px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    animation: rise .5s ease both;
}

.login-box > img {
    display: block;
    width: min(100%, 250px) !important;
    max-height: 92px;
    margin: 0 auto 24px;
    object-fit: contain;
}

.login-title { margin: 0; color: #101828; font-size: 27px; line-height: 1.15; font-weight: 700; text-align: center; letter-spacing: -.04em; }
.login-subtitle { margin: 8px 0 27px; color: #667085; font-size: 13px; text-align: center; }
.login-button {
    width: 100%;
    min-height: 46px;
    margin-top: 5px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #1047b8);
    box-shadow: 0 10px 24px rgba(21,94,239,.2);
    font-size: 14px;
    font-weight: 700;
    transition: .2s ease;
}
.login-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(21,94,239,.27); }

.admin-page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.admin-page-intro p { max-width: 650px; margin-bottom: 0; }
.admin-stat {
    min-width: 130px;
    padding: 15px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}
.admin-stat-number { display: block; color: var(--primary); font-size: 27px; line-height: 1; font-weight: 700; }
.admin-stat-label { display: block; margin-top: 5px; color: #98a2b3; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.admin-card { margin-bottom: 20px; }
.admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 24px 18px;
}
.admin-card-header h2 { margin: 0; color: #101828; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.admin-card-header p { margin: 5px 0 0; color: #98a2b3; font-size: 12px; }
.admin-card-icon { display: grid; place-items: center; width: 36px; height: 36px; color: var(--primary); background: #eff4ff; border-radius: 10px; font-size: 20px; font-weight: 500; }
.admin-user-form {
    display: grid;
    grid-template-columns: 1fr 0.8fr 1fr;
    gap: 14px;
    align-items: end;
    padding: 0 24px 24px;
}

.admin-user-form .admin-primary-button {
    grid-column: 1 / 2;
}

.admin-form-group { margin: 0; }
.admin-primary-button { min-height: 44px; white-space: nowrap; }
.admin-table th, .admin-table td { padding-left: 20px; padding-right: 20px; }
.admin-table-action { text-align: right; }
.admin-user-cell { display: flex; align-items: center; gap: 11px; font-weight: 600; }
.admin-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; color: #175cd3; background: #eff4ff; border: 1px solid #d1e0ff; border-radius: 10px; font-size: 13px; font-weight: 700; }
.role-badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.role-admin { color: #6941c6; background: #f4f3ff; border: 1px solid #e9d7fe; }
.role-user { color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; }
.admin-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.admin-action-button { color: #175cd3; background: #eff4ff; border-color: #d1e0ff; }
.admin-delete-button { width: 40px; padding: 0; color: #b42318; background: #fff5f4; border-color: #fecdca; }
.admin-empty { padding: 36px; color: #98a2b3; text-align: center; }
.kurum-adi:hover {
    font-weight: bold;
}



.footer {
    width: min(100% - 40px, var(--container));
    margin: 0 auto;
    padding: 0 0 32px;
    color: #98a2b3;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 850px) {
    .header { padding: 10px 18px; }
    .container, .admin-content { width: min(100% - 28px, var(--container)); padding-top: 30px; }
    .admin-user-form { grid-template-columns: 1fr 1fr; }
    .admin-user-form .admin-primary-button { grid-column: 1 / -1; }
    .admin-page-intro { align-items: stretch; }
    .admin-stat { min-width: 105px; }
}

@media (max-width: 650px) {
    .header { min-height: 64px; }
    .header-title::before { width: 34px; height: 34px; flex-basis: 34px; }
    .username, .header-user { display: none; }
    .container, .admin-content { width: calc(100% - 24px); padding: 25px 0 40px; }
    .page-title, .admin-page-intro h1 { font-size: 25px; }
    .page-description { margin-bottom: 20px; }
    .info-bar { flex-direction: column; }
    .info-item { min-width: 0; }
    .section-heading { padding: 19px 16px 15px; }
    .section-title { font-size: 17px; }
    thead th, tbody td { padding: 12px 11px; }
    thead th:first-child, tbody td:first-child { padding-left: 14px; }
    .order-table { min-width: 720px; }
    .order-toolbar { align-items: flex-start; flex-direction: column; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .action-right { flex-direction: column; }
    .action-bar .btn, .action-right .btn { width: 100%; }
    .login-page { padding: 16px; }
    .login-box { padding: 29px 22px; border-radius: 18px; }
    .admin-page-intro { flex-direction: column; }
    .admin-stat { width: 100%; }
    .admin-user-form { grid-template-columns: 1fr; padding: 0 18px 20px; }
    .admin-user-form .admin-primary-button { grid-column: auto; width: 100%; }
    .admin-card-header { padding: 20px 18px 15px; }
    .admin-actions { flex-wrap: wrap; justify-content: flex-start; }
}


@media (max-width: 650px) {
    .header {
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        padding: 8px 12px;
    }

    .header-title::before {
        width: 110px;
        height: 42px;
    }

    .header-center {
        font-size: 15px;
        text-align: center;
    }

    .header-right {
        gap: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}



.table-wrapper table {
    table-layout: fixed;
    width: 100%;
}

/* Reference number column */
.table-wrapper table th:nth-child(1),
.table-wrapper table td:nth-child(1) {
    width: 150px;
}

/* Institution / work title column */
.table-wrapper table th:nth-child(2),
.table-wrapper table td:nth-child(2) {
    width: auto;
}

/* Actions column */
.table-wrapper table th:nth-child(3),
.table-wrapper table td:nth-child(3) {
    width: 260px;
}

/* Allow the title to wrap instead of widening its column */
.table-wrapper table td.kurum-adi {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    font-weight: 400;
}

/* Bold only when hovering the reference row */
.table-wrapper tbody tr:hover td.kurum-adi,
.table-wrapper tbody tr:focus-within td.kurum-adi {
    font-weight: 700;
}