/* Longshore Portal stylesheet. Source of truth: design-standards.md. Change colors and fonts here only. */

:root {
    --deep-teal: #0F3242;
    --seafoam: #BADED3;
    --antique-gold: #C0A47A;
    --soft-ivory: #F6F9F6;
    --white: #FFFFFF;
    --border: #D9E2E0;

    --success: #2F6B4F;
    --warning: #9A6B1F;
    --danger: #9B2C2C;
    --neutral: #5B6B73;

    --font-heading: "Cormorant Garamond", Georgia, serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --radius: 6px;
    --topbar-height: 64px;
    --sidebar-width: 232px;
    --content-max: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--deep-teal);
    background: var(--soft-ivory);
    font-variant-numeric: tabular-nums;
}

h1, h2, h3 { font-family: var(--font-heading); margin: 0; color: var(--deep-teal); }
p { margin: 0 0 12px; }
a { color: var(--deep-teal); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--antique-gold); outline-offset: 2px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 16px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Typography scale */
.page-title { font-size: 28px; font-weight: 600; line-height: 1.2; }
.section-heading { font-size: 21px; font-weight: 600; }
.card-title {
    font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
    margin-bottom: 12px;
}
.page-subtitle { color: var(--neutral); margin: 4px 0 0; }
label { font-size: 14px; font-weight: 500; }
.helper { font-size: 13px; color: var(--neutral); margin: 6px 0 0; }

/* Top bar */
.topbar {
    height: var(--topbar-height);
    background: var(--deep-teal);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-centered { justify-content: center; }
.topbar-logo { display: inline-flex; align-items: center; height: 100%; }
.topbar-logo img, .topbar-logo-img { height: 40px; width: auto; display: block; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-name { font-weight: 500; }
.topbar-role { font-size: 13px; opacity: 0.85; }
.topbar-user form { margin: 0; }

.menu-button {
    display: none;
    width: 40px; height: 40px;
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: var(--radius);
    flex-direction: column; justify-content: center; align-items: center; gap: 4px; cursor: pointer;
}
.menu-button span { display: block; width: 18px; height: 2px; background: var(--white); }

/* Shell: sidebar and content */
.shell { display: flex; min-height: calc(100vh - var(--topbar-height)); }

.sidebar {
    width: var(--sidebar-width);
    background: var(--deep-teal);
    flex-shrink: 0;
    padding: 16px 0;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
    display: block;
    padding: 12px 24px;
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    min-height: 44px;
}
.sidebar a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar a.active { background: var(--seafoam); color: var(--deep-teal); }
.sidebar-backdrop { display: none; }

.content { flex: 1; min-width: 0; padding: 32px 24px; }
.content-inner { max-width: var(--content-max); margin: 0 auto; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-action { flex-shrink: 0; }

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(15, 50, 66, 0.04);
}
.card-narrow { max-width: 640px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card-grid .card { margin-bottom: 0; }
.module-card p:last-of-type { margin-bottom: 16px; }
.module-card-pending { border-style: dashed; }

/* Buttons */
.button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; padding: 8px 16px;
    font-family: var(--font-body); font-size: 15px; font-weight: 500; line-height: 1.2;
    border-radius: var(--radius); border: 1px solid var(--deep-teal);
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.button-primary { background: var(--deep-teal); color: var(--white); }
.button-primary:hover { background: #163f52; }
.button-secondary { background: var(--white); color: var(--deep-teal); }
.button-secondary:hover { background: var(--soft-ivory); }
.button-danger { background: var(--danger); border-color: var(--danger); color: var(--white); }
.button-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: var(--white); }
.button-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.button.is-disabled { opacity: 0.5; cursor: default; }

/* Forms */
.form { max-width: 560px; }
.field { margin-bottom: 20px; }
.field label { display: block; margin-bottom: 6px; }
.required { font-size: 13px; font-weight: 400; color: var(--neutral); margin-left: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="search"], .field select, .table-toolbar input {
    width: 100%; min-height: 44px; padding: 8px 12px;
    font-family: var(--font-body); font-size: 15px; color: var(--deep-teal);
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
}
.field input:focus, .field select:focus, .table-toolbar input:focus { border-color: var(--deep-teal); outline: 3px solid var(--seafoam); outline-offset: 0; }
.field-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-check label { margin: 0; }
.field-check input { width: 20px; height: 20px; accent-color: var(--deep-teal); }
.field-check .field-error { width: 100%; }
.field-error { font-size: 13px; color: var(--danger); margin: 6px 0 0; font-weight: 500; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Notices */
.notice { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px; border: 1px solid; }
.notice ul { margin: 0; padding-left: 20px; }
.notice-success { background: #EAF3EE; border-color: #BFD9CB; color: var(--success); }
.notice-danger { background: #F8ECEC; border-color: #E3BEBE; color: var(--danger); }
.notice-info { background: var(--soft-ivory); border-color: var(--seafoam); color: var(--deep-teal); }
.notice-title { font-weight: 500; }
.notice-link code { display: block; word-break: break-all; font-size: 14px; background: var(--white); border: 1px solid var(--border); padding: 8px; border-radius: var(--radius); user-select: all; }

/* Status tags */
.tag {
    display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 3px 10px; border-radius: 999px; line-height: 1.4;
}
.tag-success { color: var(--success); background: #EAF3EE; }
.tag-warning { color: var(--warning); background: #F7F0E3; }
.tag-danger { color: var(--danger); background: #F8ECEC; }
.tag-neutral { color: var(--neutral); background: #EDF0F1; }

/* Tables */
.table-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.table-toolbar input { max-width: 360px; }
.table-toolbar .helper { margin: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th { background: var(--soft-ivory); color: var(--deep-teal); font-weight: 600; text-align: left; padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); background: var(--white); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--seafoam); }
.table td.money, .table th.money { text-align: right; }
.table-actions { text-align: right; white-space: nowrap; }
.table-empty { text-align: center; color: var(--neutral); padding: 32px 12px; }
.sort-button {
    background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; min-height: 24px;
    display: inline-flex; align-items: center; gap: 6px;
}

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.pagination .helper { margin: 0; }
.pagination-links { display: flex; align-items: center; gap: 12px; }
.pagination-page { font-size: 14px; color: var(--neutral); }

/* Definition lists */
.record { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.record dt { font-weight: 500; }
.record dd { margin: 0; }

/* Guest (sign-in) pages */
.guest-main { padding: 48px 16px; display: flex; flex-direction: column; align-items: center; }
.guest-card { width: 100%; max-width: 440px; }
.guest-card .page-title { margin-bottom: 4px; }
.guest-card .page-subtitle { margin-bottom: 24px; }
.guest-footer { font-size: 13px; color: var(--neutral); margin-top: 8px; text-align: center; }

/* Phones and small screens */
@media (max-width: 860px) {
    .menu-button { display: inline-flex; }
    .topbar-role { display: none; }
    .sidebar {
        position: fixed; top: var(--topbar-height); bottom: 0; left: 0;
        transform: translateX(-100%); transition: transform 0.2s ease; z-index: 40;
    }
    body.menu-open .sidebar { transform: translateX(0); }
    body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-height) 0 0 0; background: rgba(15, 50, 66, 0.4); z-index: 35; }
    .content { padding: 24px 16px; }
    .page-header { flex-direction: column; }
    .page-action .button { width: 100%; }
    .record { grid-template-columns: 1fr; gap: 2px 0; }
    .record dd { margin-bottom: 10px; }
}

@media (max-width: 480px) {
    .topbar-name { display: none; }
    .form-actions .button { width: 100%; }
}
