/* ============================================================
   eSafe DMS — Minimalist Modern Design System
   Clarity through structure, character through bold detail.
   ============================================================ */

:root {
    --background: #FAFAFA;
    --foreground: #0F172A;
    --muted: #F1F5F9;
    --muted-foreground: #64748B;
    --accent: #0052FF;
    --accent-secondary: #4D7CFF;
    --accent-foreground: #FFFFFF;
    --border: #E2E8F0;
    --card: #FFFFFF;
    --ring: #0052FF;
    --gradient: linear-gradient(135deg, #0052FF, #4D7CFF);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.10);
    --shadow-accent: 0 4px 14px rgba(0, 82, 255, 0.25);
    --shadow-accent-lg: 0 8px 24px rgba(0, 82, 255, 0.35);
    --font-display: "Calistoga", Georgia, serif;
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", Consolas, monospace;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-ui) !important;
    font-size: 14.5px;
    line-height: 1.6;
}

body, td, textarea, input, select, button {
    font-family: var(--font-ui);
    font-size: 14px;
}

h1, h2 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--foreground);
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }

h3, h4, h5 {
    font-family: var(--font-ui);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--foreground);
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-secondary); }

hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

img { max-width: 100%; }

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* ---------- Layout ---------- */

#content {
    width: auto !important;
    max-width: 72rem;
    margin: 0 auto;
    padding: 24px 20px 56px;
}

/* ---------- App Header ---------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.app-header-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.app-logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.app-logo img { height: 54px; width: auto; display: block; }

.app-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--foreground);
    background: var(--muted);
}

.nav-link-cta {
    background: var(--gradient);
    color: var(--accent-foreground);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.nav-link-cta:hover {
    background: var(--gradient);
    color: var(--accent-foreground);
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
}

.nav-link-logout {
    border: 1px solid var(--border);
    color: var(--muted-foreground);
}

.nav-link-logout:hover {
    border-color: rgba(209, 47, 25, 0.35);
    color: #d12f19;
    background: rgba(209, 47, 25, 0.05);
}

/* Hamburger */
.nav-toggle {
    display: none;
    margin-left: auto;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--foreground);
    transition: all 0.25s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Sub Bar (user + breadcrumb strip) ---------- */

.app-subbar {
    background: var(--foreground);
    color: rgba(255, 255, 255, 0.85);
}

.app-subbar-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 12px 3px 9px;
    border: 1px solid rgba(77, 124, 255, 0.45);
    border-radius: 999px;
    background: rgba(0, 82, 255, 0.18);
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}

.user-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-secondary);
    animation: esafe-pulse 2s ease-in-out infinite;
}

@keyframes esafe-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.page-crumb { color: rgba(255, 255, 255, 0.7); }
.page-crumb a, .app-subbar a { color: #fff; }
.page-crumb a:hover, .app-subbar a:hover { color: var(--accent-secondary); }

/* ---------- App Footer ---------- */

.app-footer {
    border-top: 1px solid var(--border);
    background: var(--card);
    margin-top: 40px;
}

.app-footer-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--muted-foreground);
}

.app-footer .footer-brand {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ---------- Buttons ---------- */

.btn,
input[type="submit"],
input[type="button"],
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius);
    background: var(--gradient);
    color: var(--accent-foreground);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
button[type="submit"]:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
    color: var(--accent-foreground);
}

.btn:active,
input[type="submit"]:active,
button[type="submit"]:active {
    transform: scale(0.98);
}

.btn-outline {
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--muted);
    border-color: rgba(0, 82, 255, 0.3);
    box-shadow: var(--shadow-sm);
    filter: none;
    color: var(--foreground);
}

.btn-danger {
    background: #DC2626;
    color: #fff;
}

.btn-danger:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3); }

.btn-warn {
    background: #D97706;
    color: #fff;
}

.btn-warn:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3); }

.btn-block { width: 100%; }

/* ---------- Forms ---------- */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="file"],
textarea,
select {
    padding: 10px 14px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--foreground);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
}

textarea { min-height: 90px; }

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}

input::placeholder, textarea::placeholder { color: var(--muted-foreground); opacity: 0.6; }

input[type="checkbox"], input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

label { font-weight: 500; }

/* Legacy form tables become card-like */
.form-table {
    border-collapse: separate !important;
    border-spacing: 0;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 16px 0 !important;
}

.form-table th {
    text-align: left;
    padding: 14px 18px;
    background: var(--muted);
    color: var(--foreground);
    font-weight: 600;
    font-size: 13px;
    text-shadow: none !important;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    width: 220px;
}

.form-table td {
    padding: 12px 18px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.form-table tr:last-child th,
.form-table tr:last-child td { border-bottom: none; }

/* ---------- Generic data tables / DataTables ---------- */

#filetable_wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.dataTables_wrapper {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 14px 16px 10px;
    margin-top: 14px;
    overflow-x: auto;
}

table.display {
    width: 100%;
    border-collapse: collapse;
}

table.display thead th,
table.display tfoot th {
    background: transparent !important;
    color: var(--muted-foreground);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 12px 10px;
    border-bottom: 2px solid var(--border) !important;
    text-align: left;
}

table.display tfoot th { border-bottom: none !important; border-top: 2px solid var(--border) !important; }

table.display tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    background: transparent !important;
}

table.display tbody tr { background: transparent !important; transition: background 0.15s ease; }
table.display tbody tr:hover { background: rgba(0, 82, 255, 0.04) !important; }
table.display tbody tr:hover td { background: transparent !important; }

table.display tr.odd, table.display tr.odd td,
table.display tr.even, table.display tr.even td {
    background: transparent !important;
}

table.display tr.odd { background: rgba(241, 245, 249, 0.55) !important; }

.odd { background-color: rgba(241, 245, 249, 0.55) !important; }
.even { background-color: transparent !important; }

/* DataTables controls */
.dataTables_length, .dataTables_filter {
    padding: 4px 0 12px;
    color: var(--muted-foreground);
    font-size: 13px;
}

.dataTables_length select {
    min-height: 36px;
    padding: 6px 10px;
    margin: 0 6px;
}

.dataTables_filter input {
    min-height: 38px;
    padding: 8px 12px;
    margin-left: 8px;
    width: 200px;
}

.dataTables_info {
    color: var(--muted-foreground);
    font-size: 12.5px;
    padding-top: 12px;
}

.dataTables_paginate {
    padding-top: 10px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.dataTables_paginate .paginate_button,
.dataTables_paginate .paginate_active,
.dataTables_paginate span.first,
.dataTables_paginate span.previous,
.dataTables_paginate span.next,
.dataTables_paginate span.last {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 4px 10px;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    background: var(--card) !important;
    color: var(--foreground) !important;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dataTables_paginate .paginate_button:hover {
    border-color: rgba(0, 82, 255, 0.4) !important;
    background: var(--muted) !important;
    color: var(--accent) !important;
}

.dataTables_paginate .paginate_active {
    background: var(--gradient) !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 600;
}

.paginate_button_disabled { opacity: 0.4; cursor: default !important; }

/* Sorting header arrows: replace image-based with subtle accent */
table.display thead th.sorting,
table.display thead th.sorting_asc,
table.display thead th.sorting_desc {
    cursor: pointer;
    background-image: none !important;
    position: relative;
    padding-right: 22px;
}

table.display thead th.sorting::after { content: "\2195"; position: absolute; right: 8px; opacity: 0.35; }
table.display thead th.sorting_asc::after { content: "\2191"; position: absolute; right: 8px; color: var(--accent); }
table.display thead th.sorting_desc::after { content: "\2193"; position: absolute; right: 8px; color: var(--accent); }

table.display thead th.sorting_asc, table.display thead th.sorting_desc { color: var(--accent); }

/* ---------- Last message / alerts ---------- */

#last_message {
    width: auto !important;
    max-width: 560px;
    border: 1px solid rgba(0, 82, 255, 0.25) !important;
    border-left: 4px solid var(--accent) !important;
    border-radius: var(--radius-sm);
    margin: 14px 0 !important;
    padding: 13px 18px !important;
    color: var(--foreground) !important;
    background: rgba(0, 82, 255, 0.06) !important;
    background-image: none !important;
    box-shadow: var(--shadow-sm);
    font-size: 13.5px;
}

/* ---------- Lockbox UI ---------- */

.lockbox-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 4px 0 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lockbox-breadcrumb a {
    color: var(--muted-foreground);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.lockbox-breadcrumb a:hover { color: var(--accent); background: rgba(0, 82, 255, 0.06); }
.lockbox-breadcrumb a:last-child { color: var(--accent); font-weight: 500; }
.lockbox-breadcrumb .sep { color: var(--border); margin: 0 2px; }

.lockbox-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.btn-lockbox {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 18px;
    border-radius: var(--radius);
    background: var(--gradient);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.btn-lockbox:hover {
    color: #fff;
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
}

.btn-lockbox:active { transform: scale(0.98); }

.btn-lockbox-warn { background: #D97706; }
.btn-lockbox-warn:hover { box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3); }

.btn-lockbox-danger { background: #DC2626; }
.btn-lockbox-danger:hover { box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3); }

.lockbox-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 18px 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.lockbox-section::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 82, 255, 0.05), transparent 70%);
    pointer-events: none;
}

.lockbox-section-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(0, 82, 255, 0.3);
    background: rgba(0, 82, 255, 0.05);
    border-radius: 999px;
    padding: 5px 14px;
    margin-bottom: 14px;
}

.lockbox-section-label .lb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: esafe-pulse 2s ease-in-out infinite;
}

.lockbox-section-label span:last-child {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
}

.lockbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.lockbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.lockbox-item:hover {
    border-color: rgba(0, 82, 255, 0.45);
    box-shadow: var(--shadow-accent);
    transform: translateY(-2px);
    color: var(--accent);
}

.lb-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--gradient);
    box-shadow: var(--shadow-accent);
    transition: transform 0.2s ease;
}

.lockbox-item:hover .lb-tile { transform: scale(1.08); }

.lb-name { display: block; line-height: 1.3; }

.lb-meta {
    display: block;
    font-weight: 400;
    font-size: 11.5px;
    color: var(--muted-foreground);
    margin-top: 2px;
}

.lockbox-empty {
    padding: 26px 20px;
    text-align: center;
    color: var(--muted-foreground);
    font-style: italic;
    background: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    margin-top: 14px;
}

/* Move chip in file table */
.move-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    transition: all 0.15s ease;
}

.move-chip:hover {
    border-color: rgba(0, 82, 255, 0.45);
    background: rgba(0, 82, 255, 0.06);
    box-shadow: var(--shadow-sm);
}

/* ---------- Modals ---------- */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    z-index: 1000;
}

.modal-box {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card);
    padding: 26px 26px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    min-width: 340px;
    max-width: calc(100vw - 32px);
    z-index: 1001;
    box-shadow: var(--shadow-xl);
}

.modal-box h3 {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.modal-box label {
    font-size: 13px;
    color: var(--muted-foreground);
    font-weight: 500;
}

.modal-box input[type=text], .modal-box select {
    width: 100%;
    margin: 7px 0 16px;
}

.modal-box .modal-btns { display: flex; justify-content: flex-end; gap: 10px; }

.modal-box .modal-btns button {
    min-height: 42px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-box .modal-btns button:hover { background: var(--muted); }

.modal-box .modal-btns .btn-primary {
    background: var(--gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.modal-box .modal-btns .btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-accent);
}

/* ---------- Login page ---------- */

body.login-page {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
}

.login-shell {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    min-height: 100vh;
}

.login-brand {
    position: relative;
    background: var(--foreground);
    color: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    overflow: hidden;
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.5) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0.04;
    pointer-events: none;
}

.login-brand-glow {
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 82, 255, 0.35), transparent 65%);
    top: -140px;
    right: -140px;
    filter: blur(60px);
    pointer-events: none;
}

.login-brand-inner { position: relative; max-width: 440px; }

.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(77, 124, 255, 0.45);
    background: rgba(0, 82, 255, 0.15);
    border-radius: 999px;
    padding: 6px 16px;
    margin-bottom: 28px;
}

.login-badge .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-secondary);
    animation: esafe-pulse 2s ease-in-out infinite;
}

.login-badge span:last-child {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    color: #B9CDFF;
}

.login-headline {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2.9rem;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0 0 20px;
}

.gradient-text {
    background: linear-gradient(to right, #4D7CFF, #8FB0FF);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-sub {
    font-size: 15.5px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.65);
    margin: 0 0 30px;
}

.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 13px; }

.login-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.login-points .pt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--gradient);
    font-size: 13px;
    color: #fff;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 38px 34px 32px;
}

.login-logo {
    display: block;
    height: 110px;
    width: auto;
    margin: 0 auto 18px;
}

.login-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.75rem;
    text-align: center;
    margin: 0 0 6px;
}

.login-hint {
    text-align: center;
    color: var(--muted-foreground);
    font-size: 13.5px;
    margin: 0 0 26px;
}

.login-form { display: block; }

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--foreground);
}

.field-input {
    width: 100%;
    margin-bottom: 18px;
}

.login-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    margin-top: 22px;
    font-size: 13.5px;
}

/* ---------- Misc legacy cleanups ---------- */

.text-warning { color: #D97706; font-size: 13px; margin-top: 10px; }

/* Old .buttons toolbar (any page still using it) */
.buttons a {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    color: var(--foreground) !important;
    font-family: var(--font-ui) !important;
    padding: 8px 14px !important;
    margin: 0 6px 6px 0 !important;
    transition: all 0.15s ease;
}

.buttons a:hover {
    border-color: rgba(0, 82, 255, 0.4) !important;
    background: var(--muted) !important;
    color: var(--accent) !important;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .nav-toggle { display: flex; }

    .app-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding: 12px 16px 16px;
        margin: 0;
    }

    .app-nav.open { display: flex; }

    .nav-link { padding: 13px 14px; font-size: 15px; }

    .app-header { position: relative; }
    .app-header-inner { position: relative; }
    .app-logo img { height: 46px; }

    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel { min-height: 100vh; }

    .form-table th { width: auto; }

    .form-table, .form-table tbody, .form-table tr, .form-table th, .form-table td {
        display: block;
        width: 100% !important;
    }

    .form-table th { border-bottom: none; padding-bottom: 4px; }
    .form-table td { border-bottom: 1px solid var(--border); }
    .form-table tr:last-child td { border-bottom: none; }
}

@media (max-width: 640px) {
    #content { padding: 16px 12px 40px; }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .dataTables_wrapper { padding: 10px 10px 8px; }
    .dataTables_filter input { width: 130px; }

    .lockbox-grid { grid-template-columns: 1fr; }

    .lockbox-toolbar .btn-lockbox { flex: 1 1 auto; justify-content: center; }

    .modal-box { min-width: 0; width: calc(100vw - 28px); }

    .login-card { padding: 28px 22px 24px; border: none; box-shadow: none; background: transparent; }
    .login-panel { padding: 24px 16px; }

    .app-subbar-inner { padding: 8px 14px; }
    .app-footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
