/* ============================================================
   DUA Services CRM — Premium Theme
   Mobile-friendly, professional navy + teal design system
   ============================================================ */
:root {
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --navy-950: #0a1c3f;
    --navy-900: #102a56;
    --navy-800: #1a3a75;
    --navy-700: #234c94;

    --teal: #0d9488;
    --teal-dark: #0f766e;
    --teal-soft: #ccfbf1;

    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --info: #2563eb;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 26px -14px rgba(15, 23, 42, .22);
    --shadow-lg: 0 18px 44px -16px rgba(10, 28, 63, .35);

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

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    font-size: 15px;
}

a {
    color: var(--navy-700);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------------- Topbar ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: 64px;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(120deg, var(--navy-950) 0%, var(--navy-900) 60%, var(--navy-800) 100%);
    color: #fff;
    box-shadow: 0 2px 14px rgba(10, 28, 63, .35);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    font-size: 17px;
    letter-spacing: .01em;
    font-weight: 700;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--teal) 0%, #14b8a6 100%);
    color: #fff;
    font-weight: 800;
    font-size: 19px;
    box-shadow: 0 4px 12px rgba(13, 148, 136, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.topbar .spacer {
    flex: 1;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.user-chip em {
    font-style: normal;
    font-weight: 500;
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--teal);
    color: #fff;
    text-transform: capitalize;
}

/* Hamburger (mobile only) */
.menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 10px;
    background: rgba(255, 255, 255, .1);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 0;
    box-shadow: none;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, .18);
    transform: none;
}

.menu-btn span {
    display: block;
    width: 19px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .2s ease, opacity .2s ease;
}

body.nav-open .menu-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.nav-open .menu-btn span:nth-child(2) {
    opacity: 0;
}

body.nav-open .menu-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------------- App shell / sidebar ---------------- */
.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 250px;
    flex: 0 0 250px;
    padding: 20px 14px 24px;
    background: linear-gradient(180deg, var(--navy-950) 0%, #0d2249 100%);
    color: #dbe4f5;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.drawer-head {
    display: none;
}

.nav-label {
    margin: 18px 8px 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7d93b8;
}

.nav-label:first-child {
    margin-top: 2px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar a,
.sidebar .logout-form button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 13px;
    border: 0;
    border-radius: var(--radius-sm);
    color: #c6d5ef;
    background: transparent;
    font-size: 14.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    min-height: 0;
    box-shadow: none;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.sidebar a:hover,
.sidebar .logout-form button:hover {
    background: rgba(255, 255, 255, .09);
    color: #fff;
    text-decoration: none;
    transform: none;
}

.sidebar a.active {
    background: rgba(13, 148, 136, .22);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--teal);
}

.logout-form {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.sidebar .logout-form button {
    color: #f3b8b8;
}

.sidebar .logout-form button:hover {
    background: rgba(220, 38, 38, .18);
    color: #fff;
}

/* ---------------- Content ---------------- */
.content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 30px 40px;
}

.footer {
    padding: 15px 22px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

h1, h2, h3 {
    margin-top: 0;
    line-height: 1.3;
    letter-spacing: -.01em;
}

h1 {
    font-size: 25px;
    font-weight: 750;
    margin-bottom: 20px;
}

h2 {
    font-size: 19px;
    font-weight: 700;
    margin-top: 28px;
    margin-bottom: 14px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-head h1 {
    margin-bottom: 0;
}

.page-head .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------------- Cards ---------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    gap: 18px;
    margin-bottom: 6px;
}

.card {
    position: relative;
    padding: 20px 20px 18px;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--teal);
    opacity: .9;
}

.card-grid .card:nth-child(4n+2)::before { background: var(--info); }
.card-grid .card:nth-child(4n+3)::before { background: var(--warning); }
.card-grid .card:nth-child(4n+4)::before { background: var(--success); }
.card-grid .card:nth-child(4n+2) p { color: var(--info); }
.card-grid .card:nth-child(4n+3) p { color: var(--warning); }
.card-grid .card:nth-child(4n+4) p { color: var(--success); }

.card h3 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.card p {
    margin: 0;
    font-size: 25px;
    font-weight: 800;
    color: var(--teal-dark);
    letter-spacing: -.01em;
}

/* ---------------- Buttons ---------------- */
button,
.button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--navy-900);
    color: #fff;
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(16, 42, 86, .22);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    white-space: nowrap;
}

button:hover,
.button:hover,
.btn:hover {
    background: var(--navy-800);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(16, 42, 86, .28);
}

button:active,
.button:active,
.btn:active {
    transform: translateY(0);
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn-teal {
    background: var(--teal-dark);
    box-shadow: 0 2px 8px rgba(13, 148, 136, .3);
}

.btn-teal:hover {
    background: var(--teal);
}

.btn-danger,
form[data-confirm] button[type="submit"] {
    background: var(--danger);
    box-shadow: 0 2px 8px rgba(220, 38, 38, .25);
}

.btn-danger:hover,
form[data-confirm] button[type="submit"]:hover {
    background: var(--danger-dark);
}

.btn-ghost,
.btn-secondary {
    background: var(--surface);
    color: var(--ink-soft);
    border-color: var(--border-strong);
    box-shadow: none;
}

.btn-ghost:hover,
.btn-secondary:hover {
    background: var(--surface-soft);
    color: var(--ink);
    box-shadow: none;
}

.btn-sm {
    min-height: 34px;
    padding: 6px 13px;
    font-size: 13px;
    border-radius: 8px;
}

/* ---------------- Forms ---------------- */
.form-card {
    max-width: 920px;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-card label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 13.5px;
    font-weight: 600;
}

.form-card label:has(input[type="checkbox"]) {
    flex-direction: row;
    grid-column: 1 / -1;
    align-items: center;
    font-weight: 500;
}

.form-card > button,
.form-card > .button,
.form-card > .btn {
    width: max-content;
    grid-column: 1 / -1;
    margin-top: 4px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 13px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    outline: 0;
    box-shadow: 0 0 0 3.5px rgba(13, 148, 136, .16);
}

input[type="checkbox"] {
    width: 17px;
    height: 17px;
    min-height: 0;
    accent-color: var(--teal-dark);
}

.filter-bar {
    margin: 0 0 18px;
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-bar input,
.filter-bar select {
    max-width: 320px;
    flex: 1 1 200px;
}

/* ---------------- Tables ---------------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    font-size: 14.5px;
}

th,
td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

tbody tr {
    transition: background .12s ease;
}

tbody tr:hover {
    background: #f6fafd;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td a {
    color: var(--teal-dark);
    font-weight: 600;
}

td a:hover {
    color: var(--teal);
}

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.b-green  { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.b-amber  { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.b-red    { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.b-blue   { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.b-gray   { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* ---------------- Alerts ---------------- */
.alert {
    max-width: 920px;
    padding: 13px 16px 13px 14px;
    margin: 0 0 18px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    border-left-width: 4px;
    font-size: 14.5px;
    box-shadow: var(--shadow);
}

.alert.error {
    color: #7a271a;
    background: #fef3f2;
    border-color: #fecdca;
    border-left-color: var(--danger);
}

.alert.success {
    color: #05603a;
    background: #ecfdf3;
    border-color: #abefc6;
    border-left-color: var(--success);
}

/* ---------------- Login ---------------- */
.login-page {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1100px 520px at 15% -5%, rgba(13, 148, 136, .28), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(35, 76, 148, .5), transparent 55%),
        linear-gradient(140deg, var(--navy-950) 0%, var(--navy-900) 55%, #0d2249 100%);
}

.login-card {
    width: min(430px, 100%);
    padding: 34px 32px 30px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.login-card::before {
    content: "\2708";
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 17px;
    background: linear-gradient(135deg, var(--teal) 0%, #14b8a6 100%);
    color: #fff;
    font-size: 27px;
    box-shadow: 0 8px 20px rgba(13, 148, 136, .4);
}

.login-card h1 {
    text-align: center;
    font-size: 23px;
    margin-bottom: 6px;
}

.login-card .alert {
    margin-top: 14px;
}

.login-card form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.login-card label {
    display: grid;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.login-card button {
    margin-top: 8px;
    min-height: 47px;
    font-size: 15.5px;
    background: linear-gradient(135deg, var(--teal-dark), var(--teal));
    box-shadow: 0 6px 18px rgba(13, 148, 136, .35);
}

.login-card button:hover {
    background: linear-gradient(135deg, #0d6e64, var(--teal-dark));
}

/* ---------------- Reports / misc ---------------- */
.report-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.report-links a {
    display: block;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 600;
    color: var(--ink-soft);
    box-shadow: var(--shadow);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.report-links a:hover {
    text-decoration: none;
    transform: translateY(-2px);
    border-color: var(--teal);
    box-shadow: var(--shadow-lg);
    color: var(--teal-dark);
}

.receipt {
    max-width: 720px;
    padding: 30px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.muted {
    color: var(--muted);
}

/* charts container */
[data-bar-chart] {
    margin-top: 6px;
}

/* focus visibility for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(13, 148, 136, .4);
    outline-offset: 2px;
}
