:root {
    --bg: #f5f8f7;
    --surface: rgba(255, 255, 255, .88);
    --surface-solid: #ffffff;
    --ink: #17211f;
    --muted: #697a75;
    --line: #dde7e3;
    --green: #0f8a6a;
    --green-strong: #057858;
    --green-soft: #e8f6f1;
    --blue: #2f65d8;
    --orange: #d98422;
    --purple: #7357d8;
    --shadow: 0 18px 50px rgba(23, 33, 31, .08);
    --radius: 22px;
    --radius-sm: 14px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 10%, rgba(15, 138, 106, .16), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(47, 101, 216, .10), transparent 26%),
        linear-gradient(180deg, #f8fbfa 0%, var(--bg) 100%);
}

a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(18px, 4vw, 52px);
    backdrop-filter: blur(18px);
    background: rgba(245, 248, 247, .78);
    border-bottom: 1px solid rgba(221, 231, 227, .8);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(15, 138, 106, .18);
    box-shadow: 0 12px 30px rgba(15, 138, 106, .16);
}
.brand-mark img { width: 34px; height: 34px; object-fit: contain; display: block; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 12px; }

.mobile-menu-button {
    display: none;
    place-items: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--green-strong);
    cursor: pointer;
}
.mobile-menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
}
.topbar.is-menu-open .mobile-menu-button span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.topbar.is-menu-open .mobile-menu-button span:nth-child(2) {
    opacity: 0;
}
.topbar.is-menu-open .mobile-menu-button span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.topbar-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
    color: var(--muted);
    font-weight: 650;
    padding: 10px 14px;
    border-radius: 999px;
}
.nav-links a.active, .nav-links a:hover { color: var(--green-strong); background: var(--green-soft); }
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.notification-wrap {
    position: relative;
}
.notification-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--green-strong);
    cursor: pointer;
}
.notification-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.notification-button span {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #d98422;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    font-weight: 900;
}
.notification-button:hover { border-color: rgba(15, 138, 106, .35); background: var(--green-soft); }
.notification-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 40;
    width: min(360px, calc(100vw - 36px));
    overflow: hidden;
    border: 1px solid rgba(221,231,227,.95);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(23, 33, 31, .16);
}
.notification-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.notification-panel-head strong {
    color: var(--ink);
    font-size: 14px;
}
.notification-panel-head button,
.notification-panel-head a {
    border: 0;
    background: transparent;
    color: var(--green-strong);
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}
.notification-list {
    display: grid;
    max-height: 380px;
    overflow: auto;
}
.notification-item {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 13px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}
.notification-item:hover {
    background: #f8fbfa;
}
.notification-item strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notification-item span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notification-item small {
    color: var(--muted);
    font-size: 11px;
}
.notification-empty {
    padding: 18px 16px;
    color: var(--muted);
    font-size: 13px;
}

.main-content {
    width: min(1500px, calc(100% - 36px));
    margin: 0 auto;
    padding: 32px 0 54px;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 26px;
    align-items: stretch;
    padding: clamp(28px, 4vw, 56px);
    border: 1px solid rgba(221, 231, 227, .88);
    border-radius: 34px;
    background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(232,246,241,.92));
    box-shadow: var(--shadow);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--green-strong);
    background: var(--green-soft);
    border: 1px solid rgba(15, 138, 106, .14);
    padding: 7px 11px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(34px, 5vw, 64px); line-height: .98; margin-top: 14px; }
h2 { font-size: 22px; margin-bottom: 16px; }
p { color: var(--muted); line-height: 1.72; }
.hero-card p { max-width: 720px; font-size: 18px; }

.hero-actions, .header-actions, .form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero-actions { margin-top: 28px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
}
.btn.primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--green), #12a77b); box-shadow: 0 10px 22px rgba(15, 138, 106, .22); }
.btn.secondary { color: var(--green-strong); background: #fff; }
.btn.danger { color: #9c580f; border-color: rgba(217, 132, 34, .34); background: #fff6e9; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }

.hero-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.flow-step {
    padding: 20px;
    border: 1px solid rgba(221,231,227,.86);
    border-radius: var(--radius);
    background: rgba(255,255,255,.76);
}
.flow-step strong {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 16px;
    border-radius: 12px;
    color: #fff;
    background: var(--green);
}
.flow-step span { display: block; font-size: 19px; font-weight: 850; }
.flow-step small { color: var(--muted); }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 22px 0;
}
.metric-card, .card, .table-card {
    border: 1px solid rgba(221,231,227,.88);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.metric-card { padding: 22px; }
.metric-card span, .metric-card small { color: var(--muted); display: block; }
.metric-card strong { display: block; font-size: 38px; letter-spacing: -.04em; margin: 8px 0 2px; }

.content-grid { display: grid; gap: 18px; margin-top: 22px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-grid { grid-template-columns: minmax(420px, .75fr) minmax(560px, 1.25fr); align-items: start; }
.card { padding: 24px; }
.accent-card { background: linear-gradient(135deg, #ffffff, var(--green-soft)); }
.clean-list { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.9; }
.clean-list strong { color: var(--ink); }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}
.page-header h1 { font-size: clamp(30px, 4vw, 48px); }
.page-header p { margin-bottom: 0; }

.table-card { overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #f8fbfa; }
th, td { padding: 16px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.align-right { text-align: right; }
.empty-table { text-align: center; color: var(--muted); padding: 34px 18px; }
.data-table th:nth-child(5),
.data-table td.status-cell {
    width: 150px;
    text-align: center;
}
.data-table td.status-cell .status-badge {
    justify-content: center;
    min-width: 112px;
    white-space: nowrap;
}
.data-table th:last-child,
.data-table td.align-right {
    width: 230px;
    text-align: center;
}
.row-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.data-table td.align-right .btn.small {
    width: 84px;
    min-height: 38px;
    padding: 0 12px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}
.data-table td.align-right .btn.danger {
    width: 92px;
}
.attachment-list { display: grid; gap: 8px; min-width: 190px; }
.attachment-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attachment-item > span {
    max-width: 260px;
    overflow-wrap: anywhere;
    font-weight: 750;
}
.attachment-item small {
    display: inline-flex;
    margin: 0;
    color: var(--muted);
}
.btn.attachment-preview {
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.filter-panel {
    display: grid;
    grid-template-columns: minmax(240px, 1.2fr) minmax(150px, 190px) minmax(150px, 190px) minmax(150px, 180px) minmax(150px, 180px) auto auto;
    align-items: end;
    gap: 14px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid rgba(221,231,227,.88);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.filter-panel label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.filter-summary {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}
.filter-note {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}
.filter-note.is-error { color: #9c580f; }

.inline-alert {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(217, 132, 34, .28);
    border-radius: 14px;
    color: #8b4d0f;
    background: #fff6e9;
    font-weight: 750;
}
.required-fields-alert {
    display: grid;
    gap: 8px;
}
.required-fields-alert ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.required-fields-alert li {
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(217, 132, 34, .12);
    color: #8b4d0f;
    font-size: 12px;
    font-weight: 850;
}

.inline-success {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 138, 106, .22);
    border-radius: 14px;
    color: var(--green-strong);
    background: var(--green-soft);
    font-weight: 750;
}

.login-shell {
    min-height: calc(100vh - 150px);
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid rgba(221,231,227,.88);
    border-radius: var(--radius);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
}

.login-panel h1 { font-size: 42px; }
.login-form { display: grid; gap: 14px; margin-top: 20px; }
.login-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.upload-box {
    display: grid;
    gap: 12px;
    padding: 22px;
    border: 1px dashed rgba(15, 138, 106, .34);
    border-radius: var(--radius-sm);
    background: #f8fbfa;
}

.upload-box p { margin: 0; }
.upload-summary { margin-top: 16px; }

.upload-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 22px;
}

.upload-result h2 { margin-top: 10px; }

.locked-preview {
    min-height: 360px;
    display: grid;
    align-content: center;
    gap: 12px;
}
.locked-preview h2 { margin-bottom: 0; }
.locked-preview p { margin: 0; }

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
}
.status-badge.is-green { color: #08724f; background: #dff7ee; }
.status-badge.is-blue { color: #235bc7; background: #e8efff; }
.status-badge.is-orange { color: #9c580f; background: #fff2df; }
.status-badge.is-purple { color: #5f43c2; background: #f0edff; }
.status-badge.is-gray { color: #596865; background: #edf2f0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.form-card label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.field-caption { color: var(--muted); font-size: 13px; font-weight: 900; line-height: 1.25; }
.field-caption small { color: #7a8a87; font-size: 11px; font-weight: 700; margin-left: 3px; white-space: nowrap; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    padding: 12px 13px;
    font: inherit;
    outline: none;
}
textarea { min-height: 72px; resize: vertical; }
.thai-date-input {
    position: relative;
    display: block;
}
.thai-date-input > input:first-child { padding-right: 54px; }
.thai-date-picker {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 42px;
    height: 36px;
    min-height: 0;
    padding: 0;
    transform: translateY(-50%);
    color: transparent;
    background: transparent;
    border-color: transparent;
    cursor: pointer;
}
.thai-date-picker::-webkit-calendar-picker-indicator {
    width: 22px;
    height: 22px;
    cursor: pointer;
    opacity: .72;
}
.template-box { min-height: 520px; line-height: 1.65; font-family: Consolas, "Courier New", monospace; }
.form-actions { margin-top: 16px; }

.preview-wrap { position: sticky; top: 92px; }
.preview-notice {
    display: grid;
    gap: 4px;
    margin: 0 auto 12px;
    max-width: 820px;
    padding: 13px 16px;
    border: 1px solid rgba(217, 132, 34, .28);
    border-radius: 14px;
    background: #fff6e9;
    color: #8b4d0f;
}
.preview-notice strong { font-size: 14px; }
.preview-notice span { color: #8b4d0f; line-height: 1.55; }
.cert-paper {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 44px 48px;
    min-height: 1040px;
    border: 1px solid #d8d8d8;
    background: #fff;
    color: #111;
    box-shadow: 0 28px 70px rgba(23, 33, 31, .12);
    font-family: "Times New Roman", serif;
    overflow-wrap: anywhere;
}
.cert-title { text-align: center; font-size: 24px; font-weight: 800; text-decoration: underline; margin-bottom: 26px; }
.cert-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.cert-statement {
    color: #111;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    margin: 18px 0 24px;
}
.cert-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px 14px; font-size: 15px; line-height: 1.42; }
.cert-grid label { font-weight: 800; }
.cert-grid div { min-height: 22px; border-bottom: 1px dotted #b8b8b8; white-space: pre-line; }
.cert-footer { margin-top: 42px; color: #111; text-align: center; }
.cert-footer p { color: #111; line-height: 1.45; margin: 8px 0; }
.signature-line { width: 260px; height: 64px; margin: 28px auto 6px; border-bottom: 1px solid #111; }

.setting-list { display: grid; gap: 14px; }
.setting-list div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting-list span { color: var(--muted); }
.text-green { color: var(--green-strong); }
.text-orange { color: var(--orange); }

.empty-state { text-align: center; padding: 90px 20px; }

@media (max-width: 1100px) {
    .hero-card, .two-columns, .review-grid { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .preview-wrap { position: static; }
}

@media (max-width: 760px) {
    .topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px 12px;
        padding: 14px 16px;
    }
    .brand { min-width: 0; }
    .brand > span:last-child { min-width: 0; }
    .brand strong,
    .brand small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .brand-mark {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }
    .mobile-menu-button {
        display: grid;
    }
    .topbar-actions {
        display: none;
        grid-column: 1 / -1;
        width: 100%;
        padding: 12px;
        border: 1px solid rgba(221,231,227,.88);
        border-radius: 18px;
        background: rgba(255,255,255,.96);
        box-shadow: 0 16px 38px rgba(23, 33, 31, .10);
        justify-content: flex-start;
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }
    .topbar.is-menu-open .topbar-actions {
        display: flex;
    }
    .nav-links {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 6px;
        overflow: visible;
        padding-bottom: 0;
    }
    .nav-links a {
        padding: 11px 12px;
        border-radius: 14px;
        white-space: nowrap;
    }
    .user-menu {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
        padding-top: 10px;
        border-top: 1px solid var(--line);
    }
    .user-menu > span {
        min-width: 0;
        max-width: calc(100% - 150px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .notification-panel {
        left: 0;
        right: auto;
        max-width: calc(100vw - 64px);
        width: min(360px, calc(100vw - 64px));
    }
    .main-content {
        width: min(1500px, calc(100% - 24px));
        padding: 20px 0 36px;
    }
    .hero-card {
        padding: 24px;
        border-radius: 24px;
    }
    h1 { font-size: 34px; line-height: 1.05; }
    .page-header h1 { font-size: 30px; line-height: 1.08; }
    .page-header p { margin-top: 10px; }
    .header-actions,
    .form-actions,
    .hero-actions {
        width: 100%;
    }
    .header-actions .btn,
    .form-actions .btn,
    .hero-actions .btn,
    .upload-result .btn {
        width: 100%;
    }
    .metric-grid, .form-grid, .hero-panel { grid-template-columns: 1fr; }
    .filter-panel {
        grid-template-columns: 1fr;
        padding: 14px;
        border-radius: 18px;
    }
    .filter-summary {
        white-space: normal;
    }
    .page-header { align-items: flex-start; flex-direction: column; }
    .table-card {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }
    .data-table {
        border-collapse: separate;
        background: transparent;
    }
    .data-table thead { display: none; }
    .data-table tr {
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid rgba(221,231,227,.88);
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 12px 34px rgba(23, 33, 31, .07);
    }
    .data-table td {
        display: grid;
        grid-template-columns: minmax(92px, .36fr) minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
        text-align: left;
    }
    .data-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 900;
        line-height: 1.35;
    }
    .data-table td.empty-table {
        display: block;
        padding: 22px 6px;
        text-align: center;
    }
    .data-table td.empty-table::before { content: none; }
    .data-table td.status-cell,
    .data-table td.align-right {
        width: 100%;
        text-align: left;
    }
    .data-table td.status-cell .status-badge {
        justify-content: center;
        min-width: 0;
        max-width: 100%;
    }
    .data-table td.align-right {
        border-bottom: 0;
        padding-bottom: 0;
    }
    .row-actions {
        justify-content: stretch;
    }
    .data-table td.align-right .btn.small,
    .data-table td.align-right .btn.danger {
        width: auto;
        flex: 1 1 118px;
    }
    .attachment-list {
        min-width: 0;
    }
    .attachment-item > span {
        max-width: 100%;
    }
    .upload-result {
        align-items: flex-start;
        flex-direction: column;
    }
    .login-shell { min-height: calc(100vh - 120px); }
    .login-panel { padding: 24px; }
    .login-panel h1 { font-size: 34px; }
    .cert-paper { padding: 28px 22px; min-height: auto; }
    .cert-title { font-size: 21px; }
    .cert-meta {
        flex-direction: column;
        gap: 4px;
    }
    .cert-statement {
        white-space: normal;
    }
    .cert-grid { grid-template-columns: 1fr; }
    .cert-grid label { margin-top: 8px; }
    .setting-list div {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    .main-content {
        width: min(1500px, calc(100% - 16px));
    }
    .brand small { display: none; }
    .user-menu > span {
        max-width: 100%;
        order: 3;
    }
    .card,
    .metric-card {
        padding: 18px;
        border-radius: 18px;
    }
    .data-table tr {
        padding: 12px;
        border-radius: 16px;
    }
    .data-table td {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    .row-actions .btn.small {
        flex-basis: 100%;
    }
    .cert-paper {
        padding: 22px 16px;
    }
}

@media print {
    body, .main-content { background: #fff; }
    .topbar, .page-header, .form-card { display: none !important; }
    .review-grid { display: block; }
    .cert-paper { max-width: none; box-shadow: none; border: none; min-height: auto; }
}
