@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@400;500;700;800&display=swap');

:root {
    color-scheme: dark;
    --bg:        #060810;
    --panel:     #0d1117;
    --panel-2:   #111827;
    --text:      #e2e8f0;
    --muted:     #64748b;
    --line:      #1e2d4a;
    --primary:   #00d4ff;
    --primary-2: #00b8e6;
    --purple:    #a855f7;
    --orange:    #ff6b2b;
    --danger:    #f87171;
    --warn:      #fbbf24;
    --info:      #38bdf8;
    --success:   #34d399;
    --shadow:    0 20px 60px rgba(0, 0, 0, .6);
    --glow-cyan: 0 0 24px rgba(0, 212, 255, .15);
    --glow-purple: 0 0 24px rgba(168, 85, 247, .15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

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

/* ───── LOGIN ───── */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, rgba(0,212,255,.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(168,85,247,.08) 0%, transparent 60%),
        var(--bg);
    position: relative;
}

.login-shell {
    width: min(100%, 440px);
    position: relative;
    z-index: 1;
}

.login-panel,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.login-panel {
    padding: 36px 32px;
    box-shadow: var(--shadow), var(--glow-cyan);
}

/* ───── TOPBAR ───── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px clamp(16px, 4vw, 48px);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 1;
}

.topbar::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--purple) 100%);
    opacity: .4;
}

h1, h2 {
    margin: 0;
    letter-spacing: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
}

h1 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 22px;
    color: var(--text);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.muted,
.hint,
td span {
    color: var(--muted);
}

.hint {
    margin: 0;
    font-size: 13px;
}

/* ───── TABS ───── */
.tabs {
    display: flex;
    gap: 4px;
    padding: 10px clamp(16px, 4vw, 48px);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    position: relative;
    z-index: 1;
}

.tabs a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
    transition: color .2s, background .2s;
}

.tabs a:hover {
    color: var(--text);
    background: rgba(255,255,255,.04);
}

.tabs a.active {
    background: rgba(0, 212, 255, .12);
    color: var(--primary);
    border: 1px solid rgba(0, 212, 255, .2);
}

/* ───── LAYOUT ───── */
.container {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 48px) 48px;
    position: relative;
    z-index: 1;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .65fr);
    align-items: start;
}

.panel {
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stack {
    display: grid;
    gap: 15px;
}

.fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

/* ───── FORMS ───── */
label {
    display: grid;
    gap: 7px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    background: var(--panel-2);
    font: inherit;
    font-weight: 500;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, .12);
}

textarea {
    resize: vertical;
}

select option {
    background: var(--panel-2);
}

/* ───── BUTTONS ───── */
button,
.ghost {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    transition: background .2s, box-shadow .2s, opacity .2s;
}

.primary {
    background: linear-gradient(135deg, var(--primary), #0099cc);
    color: #060810;
}

.primary:hover {
    box-shadow: 0 0 20px rgba(0, 212, 255, .4);
    opacity: .9;
}

.secondary {
    background: var(--panel-2);
    color: var(--text);
    border-color: var(--line);
}

.secondary:hover {
    border-color: rgba(0, 212, 255, .3);
    color: var(--primary);
}

.success {
    background: rgba(52, 211, 153, .12);
    color: var(--success);
    border-color: rgba(52, 211, 153, .25);
}

.danger {
    background: rgba(248, 113, 113, .1);
    color: var(--danger);
    border-color: rgba(248, 113, 113, .25);
}

.ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}

.ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.icon {
    width: 36px;
    padding: 0;
    background: var(--panel-2);
    border-color: var(--line);
    color: var(--muted);
}

/* ───── ALERTS ───── */
.alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
    border: 1px solid;
}

.alert.success {
    color: var(--success);
    background: rgba(52, 211, 153, .08);
    border-color: rgba(52, 211, 153, .25);
}

.alert.error {
    color: var(--danger);
    background: rgba(248, 113, 113, .08);
    border-color: rgba(248, 113, 113, .25);
}

/* ───── SECTION HEAD ───── */
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

/* ───── TABLE ───── */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

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

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}

tr:hover td {
    background: rgba(255,255,255,.02);
}

td strong,
td span {
    display: block;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

/* ───── BADGES ───── */
.badge {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.badge.pending {
    background: rgba(251, 191, 36, .12);
    color: var(--warn);
    border: 1px solid rgba(251, 191, 36, .25);
}

.badge.validated,
.badge.sent {
    background: rgba(52, 211, 153, .12);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, .25);
}

/* ───── SMALL LINK ───── */
.small-link {
    display: inline-block;
    margin-top: 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}

.small-link:hover {
    text-shadow: 0 0 10px rgba(0, 212, 255, .5);
}

/* ───── METRICS ───── */
.metrics,
.mini-metrics {
    display: grid;
    gap: 14px;
}

.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.metric,
.mini-metrics div {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.metric::before,
.mini-metrics div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--purple));
    opacity: 0;
    transition: opacity .2s;
}

.metric:hover,
.mini-metrics div:hover {
    border-color: rgba(0, 212, 255, .2);
    box-shadow: var(--glow-cyan);
}

.metric:hover::before,
.mini-metrics div:hover::before {
    opacity: 1;
}

.metric span,
.mini-metrics span {
    display: block;
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.metric strong,
.mini-metrics strong {
    display: block;
    margin-top: 6px;
    font-size: 28px;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    color: var(--primary);
    letter-spacing: .02em;
}

/* ───── FILTERS ───── */
.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 150px auto;
    gap: 9px;
    align-items: end;
}

/* ───── EMPTY STATE ───── */
.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 28px;
    font-size: 15px;
}

/* ───── MODAL ───── */
dialog {
    width: min(620px, calc(100% - 26px));
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow), var(--glow-purple);
    background: var(--panel);
    color: var(--text);
}

dialog::backdrop {
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(4px);
}

.modal-form {
    padding: 24px;
    display: grid;
    gap: 15px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ───── SCROLLBAR ───── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ───── RESPONSIVE ───── */
@media (max-width: 860px) {
    .grid.two,
    .metrics,
    .fields {
        grid-template-columns: 1fr;
    }

    .section-head.responsive {
        display: grid;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
    }
}
