/* NAQS Aquatic Export Certificate Portal — design system */

:root {
    --ink: #16241c;
    --ink-soft: #4b5b52;
    --line: #e4e9e5;
    --surface: #ffffff;
    --canvas: #f3f6f4;
    --canvas-deep: #eef2ef;

    --green-900: #0f3320;
    --green-800: #163f27;
    --green-700: #1e4d2b;
    --green-600: #276438;
    --green-100: #e7f0e9;

    --gold-600: #a9822c;
    --gold-500: #c9a227;
    --gold-100: #fbf3dd;

    --red-700: #9c2b2b;
    --red-100: #fbe9e9;
    --amber-700: #8a5a00;
    --amber-100: #fdf1d8;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 51, 32, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 51, 32, 0.08);
    --shadow-lg: 0 20px 48px rgba(15, 51, 32, 0.14);

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--canvas);
    background-image: radial-gradient(circle at 15% -10%, rgba(30, 77, 43, 0.10), transparent 45%),
                       radial-gradient(circle at 100% 0%, rgba(201, 162, 39, 0.08), transparent 40%);
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green-700); }

/* ---------- topbar ---------- */
.topbar {
    background: linear-gradient(135deg, var(--green-900), var(--green-700) 60%, var(--green-600));
    color: #fff;
    padding: 0 28px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}
.topbar .brand img {
    height: 52px;
    width: 52px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.topbar .brand .title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.topbar .brand .title strong {
    font-size: 15px;
    letter-spacing: 0.2px;
}
.topbar .brand .title span {
    font-size: 11.5px;
    color: var(--gold-100);
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.topbar nav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar nav .who {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    margin-right: 4px;
    border-right: 1px solid rgba(255,255,255,0.25);
}
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold-500);
    color: var(--green-900);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.role-chip {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.14);
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}
.topbar nav a.link {
    color: #fff;
    text-decoration: none;
    font-size: 13.5px;
    opacity: 0.9;
    padding: 6px 4px;
}
.topbar nav a.link:hover { opacity: 1; text-decoration: underline; }

/* ---------- layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; }
.page.auth-page { max-width: none; margin: 0; padding: 0; }
.page.auth-page > .messages { max-width: 480px; margin: 24px auto 0; padding: 0 20px; }
.page-narrow {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 20px;
}

ul.errorlist {
    list-style: none;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: var(--red-100);
    color: var(--red-700);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: left;
}
ul.errorlist li { margin: 0; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 22px; margin: 0; letter-spacing: -0.2px; }
.page-header p.sub { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; }

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 22px;
}
.card-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--green-700);
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title .num {
    background: var(--green-700);
    color: #fff;
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0;
}

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.stat .l { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
.stat.pending .n { color: var(--amber-700); }
.stat.issued .n { color: var(--green-700); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-soft);
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
}
table.list td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    vertical-align: middle;
}
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: var(--canvas-deep); }
table.list td.ref { font-weight: 600; font-variant-numeric: tabular-nums; }
table.list a.row-link { text-decoration: none; color: var(--green-700); font-weight: 600; font-size: 13px; }

/* ---------- badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--amber-100); color: var(--amber-700); }
.badge-issued { background: var(--green-100); color: var(--green-700); }
.badge-revoked { background: var(--red-100); color: var(--red-700); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green-700); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--green-800); }
.btn-gold { background: var(--gold-500); color: var(--green-900); }
.btn-gold:hover { background: var(--gold-600); color: #fff; }
.btn-danger { background: var(--red-700); color: #fff; }
.btn-danger:hover { background: #7e2222; }
.btn-secondary { background: var(--canvas-deep); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: #e2e8e4; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- forms ---------- */
fieldset { border: none; padding: 0; margin: 0 0 26px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; letter-spacing: 0.15px; }
input, select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px var(--green-100);
}
.field-error { color: var(--red-700); font-size: 12px; margin-top: 4px; }
.helper { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; color: var(--ink); }

.submit-bar {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 16px 24px;
    margin: 24px -24px -24px;
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
}
.messages .success { background: var(--green-100); color: var(--green-800); border-color: #cfe4d5; }
.messages .error { background: var(--red-100); color: var(--red-700); border-color: #f1cccc; }

/* ---------- certificate detail ---------- */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc-head h1 { font-size: 22px; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.doc-meta { color: var(--ink-soft); font-size: 13px; }
dl.spec { display: grid; grid-template-columns: 220px 1fr; row-gap: 12px; column-gap: 16px; margin: 0; }
dl.spec dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--ink-soft); font-weight: 600; }
dl.spec dd { margin: 0; font-size: 14.5px; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.verify-link {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--canvas-deep);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--ink-soft);
    word-break: break-all;
}
.verify-link code { color: var(--green-700); font-weight: 600; }

/* ---------- login ---------- */
.auth-card { text-align: center; box-shadow: var(--shadow-lg); border-top: 4px solid var(--gold-500); padding: 36px 32px; }
.auth-card img.logo {
    height: 150px;
    width: 150px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 6px 16px rgba(15, 51, 32, 0.18));
}
.auth-card h1 { font-size: 21px; margin: 0 0 4px; line-height: 1.3; color: var(--green-800); }
.auth-card p.tag { color: var(--ink-soft); font-size: 13px; margin: 0 0 24px; letter-spacing: 0.3px; text-transform: uppercase; }
.auth-card form p { text-align: left; margin: 14px 0; }
.auth-card .helper-text { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 20px; line-height: 1.5; }
.auth-card .switch-link { margin-top: 18px; font-size: 13px; color: var(--ink-soft); }

/* ---------- split login/register layout ---------- */
.split-auth { min-height: 100vh; display: flex; }
.split-brand {
    flex: 0 0 42%;
    background: linear-gradient(135deg, var(--green-900), var(--green-700) 60%, var(--green-600));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 40px;
    box-sizing: border-box;
}
.split-brand .logo-badge {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 48px rgba(0,0,0,0.25);
}
.split-brand .logo-badge img { width: 175px; height: 175px; object-fit: contain; }
.split-brand .brand-text { text-align: center; max-width: 380px; }
.split-brand .brand-text h2 { color: #fff; font-size: 24px; margin: 0 0 10px; line-height: 1.3; }
.split-brand .brand-text p {
    color: var(--gold-100);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin: 0;
}
.split-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
}
.split-form .auth-card { max-width: 420px; width: 100%; }
@media (max-width: 860px) {
    .split-auth { flex-direction: column; }
    .split-brand { flex: 0 0 auto; padding: 32px 20px; }
    .split-brand .logo-badge { width: 140px; height: 140px; }
    .split-brand .logo-badge img { width: 110px; height: 110px; }
}
