/* =========================================================
   SVSML-ERP — Premium maritime theme
   --------------------------------------------------------
   Deep navy sidebar, white workspace, gold accents, modern
   SaaS feel. Two breakpoint design (desktop + mobile) with
   a hamburger-collapsed sidebar below 900px.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
    /* Brand */
    --primary:        #0a1628;     /* deep navy — sidebar, primary CTA */
    --primary-hover:  #143256;
    --primary-soft:   #1e3a5f;
    --accent:         #c9a84c;     /* gold — premium maritime accent */
    --accent-hover:   #d4b875;
    --accent-soft:    #fef3c7;

    /* Surfaces */
    --bg:           #f4f7fb;       /* page background */
    --surface:      #ffffff;       /* card background */
    --surface-alt:  #f8fafc;       /* striped row, subtle panels */
    --border:       #e2e8f0;
    --border-strong:#cbd5e1;

    /* Text */
    --text:         #0f172a;
    --text-muted:   #64748b;
    --text-light:   #94a3b8;
    --text-on-dark: #e2e8f0;

    /* Sidebar */
    --sidebar-bg:           #0a1628;
    --sidebar-bg-alt:       #0c1b34;
    --sidebar-text:         #cbd5e1;
    --sidebar-text-muted:   #64748b;
    --sidebar-text-active:  #ffffff;
    --sidebar-active-bg:    rgba(201, 168, 76, 0.16);
    --sidebar-active-bar:   #c9a84c;

    /* Status — keep prior naming so existing modules don't break */
    --red:    #ef4444;
    --yellow: #f59e0b;
    --green:  #10b981;
    --gray:   #64748b;
    --info:   #3b82f6;

    /* Effects */
    --radius:     8px;
    --radius-lg:  12px;
    --radius-pill:9999px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:    0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.10);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
code { font-family: 'JetBrains Mono', SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* ---------- Layout shell ---------- */
.layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #0a1628;
    box-shadow: var(--shadow-md);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.brand {
    padding: 20px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, #b89539 100%);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(201, 168, 76, 0.3);
}
.brand-text { min-width: 0; flex: 1; }
.brand-short {
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    line-height: 1.2;
}
.brand-full {
    color: var(--text-on-dark);
    font-size: 11px;
    margin-top: 2px;
    opacity: 0.75;
    line-height: 1.3;
}

.nav {
    padding: 12px 12px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-section {
    color: var(--sidebar-text-muted);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 12px 6px;
    margin: 0;
}

.nav-link {
    color: var(--sidebar-text);
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 11px;
    transition: background .12s ease, color .12s ease;
    position: relative;
    text-decoration: none !important;
    line-height: 1.3;
}
.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.8;
    opacity: 0.85;
}
.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #ffffff;
}
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 600;
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--sidebar-active-bar);
    border-radius: 0 3px 3px 0;
}
.nav-link.active svg { color: var(--accent); opacity: 1; }
.nav-link.disabled {
    color: var(--sidebar-text-muted);
    cursor: not-allowed;
    opacity: 0.55;
}

/* ---------- Main column ---------- */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 26px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-sm);
}
.topbar-left  { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 18px; font-weight: 600; color: var(--text); }
.breadcrumb {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-light); }

.hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    width: 38px; height: 38px;
    border-radius: var(--radius);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.hamburger:hover { background: var(--surface-alt); }
.hamburger svg { width: 20px; height: 20px; }

.icon-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none !important;
    transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge-dot {
    position: absolute;
    top: 6px; right: 6px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
    line-height: 1;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
    color: white;
    font-weight: 600;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-info .user-role-text { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* ---------- Content area ---------- */
.content {
    padding: 24px 26px;
    max-width: 1400px;
    width: 100%;
}
.footer {
    padding: 20px 26px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 14px;
    letter-spacing: -0.01em;
}
.card-title small { font-weight: 400; color: var(--text-muted); }
.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin: 22px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* ---------- KPI tiles ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    display: block;
}
a.kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
    text-decoration: none;
}
.kpi-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 6px;
}
.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    background: var(--primary);
    color: #ffffff;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, transform .05s ease;
    text-decoration: none !important;
    line-height: 1.2;
    font-family: inherit;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #ffffff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-alt); border-color: var(--text-muted); color: var(--text); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-success { background: var(--green); border-color: var(--green); }
.btn-success:hover { background: #059669; border-color: #059669; }

.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--primary); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--primary); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row.full-row { grid-column: 1 / -1; }
.form-row > label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}
.form-row > input,
.form-row > select,
.form-row > textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="tel"], input[type="url"],
input[type="date"], input[type="time"], input[type="datetime-local"],
select, textarea {
    width: 100%;
    padding: 8px 11px;
    font-size: 13.5px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    transition: border-color .12s ease, box-shadow .12s ease;
    font-family: inherit;
}
.form-row > input:focus, .form-row > select:focus, .form-row > textarea:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 22, 40, 0.08);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.help-text { color: var(--text-muted); font-size: 12px; line-height: 1.45; margin: 4px 0 0; }
.help-text code { background: var(--surface-alt); padding: 1px 4px; border-radius: 3px; }

.switch-row { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.switch-row input[type="checkbox"] { width: auto; transform: scale(1.1); }
.switch-row label { margin: 0; font-weight: 500; color: var(--text); font-size: 13.5px; }

/* Filter bar (above tables) */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 14px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    align-items: flex-end;
}
.filter-bar .form-row { gap: 0; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table thead { background: var(--surface-alt); }
.data-table thead th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
.data-table tbody tr:nth-child(even) td { background: rgba(248, 250, 252, 0.5); }
.data-table tbody tr:hover td { background: rgba(10, 22, 40, 0.025); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Status pills ---------- */
.status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}
.status-green  { color: #065f46; background: #d1fae5; border-color: #a7f3d0; }
.status-yellow { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.status-red    { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.status-gray   { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.status-blue   { color: #1e40af; background: #dbeafe; border-color: #bfdbfe; }

/* ---------- Role badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.badge-admin     { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%); color: var(--primary); }
.badge-sub_admin { background: var(--primary); color: var(--accent); }
.badge-staff     { background: #dbeafe; color: #1e40af; }
.badge-crew      { background: #ddd6fe; color: #5b21b6; }

/* ---------- Flash messages ---------- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    border: 1px solid transparent;
    font-size: 13.5px;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.flash::before {
    content: '';
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: 4px;
}
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-success::before { background: var(--green); }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-error::before   { background: var(--red); }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.flash-warning::before { background: var(--yellow); }
.flash-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.flash-info::before    { background: var(--info); }

/* ---------- Toolbar / row actions ---------- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.action-link {
    color: var(--primary);
    font-size: 13px;
    margin-right: 8px;
    font-weight: 500;
}
.action-link.danger { color: var(--red); }

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.tab {
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none !important;
    transition: color .12s ease, border-color .12s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.pagination a, .pagination .current, .pagination .disabled {
    padding: 6px 11px;
    font-size: 12.5px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    min-width: 32px;
    text-align: center;
}
.pagination a:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border-strong); }
.pagination .current {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
.pagination .disabled { color: var(--text-light); cursor: not-allowed; opacity: 0.6; }

/* ---------- Result count line ---------- */
.result-count { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }

/* ---------- Conditional form fields ---------- */
.conditional { display: none; }
.conditional.is-shown { display: block; }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 600;
}
.empty-state p { margin: 0 0 14px; font-size: 13.5px; }

/* ---------- Auth (login/register) — premium split layout ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}
.auth-art {
    flex: 1;
    background:
        linear-gradient(135deg, rgba(10, 22, 40, 0.90) 0%, rgba(20, 50, 86, 0.88) 100%),
        radial-gradient(circle at 30% 80%, rgba(201, 168, 76, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(201, 168, 76, 0.10) 0%, transparent 60%);
    background-color: #0a1628;
    color: white;
    padding: 64px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-art::after {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 60%; height: 100%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.08) 0%, transparent 70%);
    pointer-events: none;
}
.auth-art-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}
.auth-art-brand .brand-logo { width: 48px; height: 48px; font-size: 17px; }
.auth-art-brand-text { line-height: 1.2; }
.auth-art-brand-text .top { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.auth-art-brand-text .sub { font-size: 12.5px; opacity: 0.7; margin-top: 2px; }

.auth-art-tagline {
    position: relative;
    z-index: 1;
    max-width: 460px;
}
.auth-art-tagline h2 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 14px;
}
.auth-art-tagline p {
    font-size: 15px;
    opacity: 0.85;
    line-height: 1.6;
    margin: 0;
}
.auth-art-tagline .accent { color: var(--accent); font-weight: 600; }

.auth-art-foot {
    display: flex;
    gap: 24px;
    font-size: 12.5px;
    opacity: 0.65;
    position: relative;
    z-index: 1;
}

.auth-form-side {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--surface);
}
.auth-card {
    width: 100%;
    max-width: 380px;
}
.auth-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text);
    letter-spacing: -0.02em;
}
.auth-card .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 28px;
}
.auth-card .form-row { margin-bottom: 16px; }
.auth-card .btn {
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary);
}
.auth-card .btn:hover { background: var(--primary-hover); }
.auth-switch {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 13.5px;
    color: var(--text-muted);
}
.auth-switch a { font-weight: 600; color: var(--primary); }

/* ============= Module-specific styles preserved below ============= */

/* =========================================================
   Module 9 — Travel sheet editor
   ========================================================= */
.travel-toolbar { align-items: center; }
.travel-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.travel-table-wrap { overflow-x: auto; }
.travel-table { table-layout: fixed; width: 100%; min-width: 1200px; }
.travel-table th, .travel-table td { vertical-align: top; padding: 8px; }
.travel-table th {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}
.travel-table .th-sr      { width: 56px;  text-align: center; }
.travel-table .th-details { width: 14%; }
.travel-table .th-side    { width: 19%; }
.travel-table .th-done    { width: 70px;  text-align: center; }
.travel-table .th-status  { width: 110px; }
.travel-table .th-remarks { width: 16%; }
.travel-table .th-action  { width: 80px;  text-align: right; }
.travel-table .td-sr      { text-align: center; padding-top: 14px; }
.travel-table .td-done    { text-align: center; padding-top: 14px; }
.travel-table .td-action  { text-align: right;  padding-top: 14px; }

.travel-table input[type="text"],
.travel-table input[type="date"],
.travel-table input[type="time"],
.travel-table select,
.travel-table textarea {
    width: 100%;
    font-size: 13px;
    padding: 6px 8px;
}
.travel-table textarea { resize: vertical; min-height: 44px; }

.travel-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.3;
}
.travel-stack { display: flex; flex-direction: column; gap: 6px; }
.travel-sub { display: flex; flex-direction: column; gap: 2px; }
.travel-sub > label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin: 0;
    font-weight: 500;
}
.travel-sub-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.travel-check {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.travel-check input { transform: scale(1.2); }
.travel-status-select { font-weight: 600; }
.travel-status-valid select.travel-status-select   { color: var(--green);   border-color: #bbf7d0; }
.travel-status-pending select.travel-status-select { color: var(--yellow);  border-color: #fde68a; }
.travel-status-invalid select.travel-status-select { color: var(--red);     border-color: #fecaca; }

.muted { color: var(--text-muted); }
.travel-quickadd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* =========================================================
   Field validation (Module 17)
   ========================================================= */
.field-error {
    color: var(--red);
    font-size: 12px;
    line-height: 1.3;
    margin-top: 4px;
    display: block;
}
input.has-error,
textarea.has-error,
select.has-error {
    border-color: var(--red);
    background-color: #fef2f2;
}
input.has-error:focus,
textarea.has-error:focus,
select.has-error:focus {
    outline: 2px solid #fecaca;
    box-shadow: none;
}

/* =========================================================
   Crew Portal — hero, kv-grid, row-ready
   ========================================================= */
.portal-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    background:
        linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%),
        radial-gradient(circle at 80% 20%, rgba(201, 168, 76, 0.15) 0%, transparent 60%);
    background-color: var(--primary);
    color: #fff;
    padding: 22px 26px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.portal-hero::after {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 50%; height: 100%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.10) 0%, transparent 70%);
    pointer-events: none;
}
.portal-hero a { color: #ffffff; }
.portal-hero > * { position: relative; z-index: 1; }
.portal-avatar {
    width: 76px; height: 76px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 1px;
    flex-shrink: 0;
    overflow: hidden;
    border: 3px solid rgba(201, 168, 76, 0.4);
}
.portal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.portal-hero-meta { flex: 1; min-width: 0; }
.portal-hero-meta h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.portal-hero-meta .meta-line { font-size: 13.5px; opacity: 0.85; }
.portal-hero-meta .meta-line + .meta-line { margin-top: 2px; }
.portal-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.portal-hero-actions .badge {
    background: rgba(201, 168, 76, 0.25);
    color: var(--accent);
    border: 1px solid rgba(201, 168, 76, 0.4);
}

.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px 22px;
}
.kv-row { min-width: 0; }
.kv-row > .kv-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 3px;
    font-weight: 600;
}
.kv-row > .kv-value { font-size: 14px; word-break: break-word; }
.kv-row > .kv-value.muted { color: var(--text-muted); }
.kv-row.full { grid-column: 1 / -1; }

/* Crew portal admin: green "fully ready" row highlight */
.data-table tr.row-ready td { background: #ecfdf5; }
.data-table tr.row-ready:hover td { background: #d1fae5; }

/* =========================================================
   Mobile responsive
   ========================================================= */
@media (max-width: 1024px) {
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .hamburger { display: inline-flex; }

    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform .25s ease-out;
        box-shadow: 0 0 30px rgba(0,0,0,0.4);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(10, 22, 40, 0.55);
        z-index: 150;
        backdrop-filter: blur(2px);
    }

    .main { width: 100%; }
    .topbar { padding: 0 16px; }
    .content { padding: 18px 16px; }

    .auth-wrap { flex-direction: column; }
    .auth-art {
        padding: 32px 24px;
        flex: 0 0 auto;
        min-height: 240px;
    }
    .auth-art-tagline h2 { font-size: 24px; }
    .auth-art-tagline p  { font-size: 13.5px; }
    .auth-form-side { flex: 1; padding: 28px 20px; }

    .portal-hero { flex-direction: column; align-items: flex-start; }
    .portal-avatar { width: 60px; height: 60px; font-size: 22px; }

    .topbar-title { display: none; }
    .breadcrumb { font-size: 12px; }
    .user-info { display: none; }
    .user-chip { padding: 4px; }

    .travel-toolbar { flex-direction: column; align-items: stretch; }
    .travel-toolbar-actions { justify-content: flex-start; }
}

@media (max-width: 600px) {
    .topbar { gap: 8px; }
    .icon-btn { width: 36px; height: 36px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-actions { margin-left: 0; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }
    .data-table { font-size: 12.5px; }
    .data-table thead th, .data-table tbody td { padding: 8px 10px; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .footer, .form-actions, .row-actions { display: none; }
    .main { width: 100%; }
    .card { border: 1px solid #ccc; box-shadow: none; }
}



/* =========================================================
   Module 18 — Crew onboarding (multi-step pre-portal form)
   ========================================================= */

.onboarding-body {
    background: linear-gradient(135deg, #0a1628 0%, #143256 100%);
    background-color: #0a1628;
    min-height: 100vh;
    padding: 32px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.onboarding-wrap {
    width: 100%;
    max-width: 760px;
}
.onboarding-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    box-shadow: var(--shadow-lg);
}

.onboarding-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.onboarding-header .brand-logo { width: 44px; height: 44px; }
.onboarding-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.onboarding-subtitle {
    color: var(--text-muted);
    font-size: 13.5px;
    margin-top: 2px;
}

.onboarding-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    display: flex;
    gap: 8px;
    counter-reset: step;
    flex-wrap: wrap;
}
.onboarding-steps li {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 500;
    min-width: 0;
}
.onboarding-steps .onboarding-step-num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--border-strong);
    color: var(--surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.onboarding-steps li.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.onboarding-steps li.active .onboarding-step-num {
    background: var(--accent);
    color: var(--primary);
}
.onboarding-steps li.done {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--primary);
}
.onboarding-steps li.done .onboarding-step-num { background: var(--accent); color: var(--primary); }
.onboarding-steps .onboarding-step-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.agree-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    margin: 8px 0;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    line-height: 1.5;
}
.agree-row input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 3px;
    transform: scale(1.15);
    accent-color: var(--primary);
}
.agree-row label {
    margin: 0;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
    font-weight: normal;
}
.agree-row label strong { color: var(--primary); display: inline-block; margin-right: 4px; }

.contact-block {
    margin: 18px 0 22px;
    padding: 14px 16px;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
}
.contact-block h4 {
    margin: 0 0 4px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.contact-block p { margin: 0; }

.kin-block {
    margin-bottom: 22px;
    padding: 18px 20px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.kin-block .section-title { margin-top: 0; }

@media (max-width: 700px) {
    .onboarding-card { padding: 22px 20px; }
    .onboarding-steps { flex-direction: column; }
    .onboarding-steps li { flex: 0 0 auto; }
    .onboarding-step-lbl { white-space: normal; }
}



/* =========================================================
   Module 9 — Travel sheet: per-row file attachment row
   ========================================================= */
.travel-row-attach td {
    background: var(--surface-alt) !important;
    border-bottom: 2px solid var(--border-strong) !important;
    padding: 6px 14px !important;
}
.travel-attach-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.travel-attach-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin: 0;
}
.travel-attach-form input[type="file"] {
    font-size: 12px;
    padding: 4px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.travel-action-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}
