:root {
    --accent: #00f0ff;
    --accent-soft: rgba(0, 240, 255, 0.15);
    --accent-2: #ff2bd6;
    --accent-2-soft: rgba(255, 43, 214, 0.15);
    --bg: #05030f;
    --bg-2: #0b0620;
    --panel: #100a22;
    --panel-2: #170e30;
    --border: rgba(150, 120, 255, 0.18);
    --border-accent: rgba(0, 240, 255, 0.38);
    --text: #d9e6ff;
    --text-dim: #9aa7c9;
    --text-faint: #6b7398;
    --danger: #ff2e6b;
    --warning: #ffd23f;
    --glow: rgba(0, 240, 255, 0.35);
    --glow-2: rgba(255, 43, 214, 0.30);
    --radius: 10px;
    --mono: 'Courier New', monospace;
    --sans: system-ui, sans-serif;
}

::selection { background: var(--accent-2); color: #08040f; }

* { box-sizing: border-box; }

html { scrollbar-color: var(--accent) var(--bg-2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 6px; }

body {
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    background-image:
        radial-gradient(circle at 12% 0%, rgba(255, 43, 214, 0.10), transparent 45%),
        radial-gradient(circle at 100% 0%, rgba(0, 240, 255, 0.10), transparent 42%),
        radial-gradient(circle at 50% 120%, rgba(124, 0, 255, 0.14), transparent 55%),
        linear-gradient(rgba(120, 200, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 200, 255, 0.03) 1px, transparent 1px);
    background-size: auto, auto, auto, 44px 44px, 44px 44px;
    background-attachment: fixed;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-shadow: 0 0 10px var(--glow); }

h1, h2, h3, h4 {
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: #eaf6ff;
    margin: 0 0 0.6em;
}
h1 { font-size: 1.5rem; text-shadow: 0 0 18px var(--glow); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

code, pre, .mono { font-family: var(--mono); }

/* ---------- Layout ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: linear-gradient(180deg, var(--bg-2), #0a051a);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.brand img { max-height: 38px; max-width: 140px; }
.brand-name {
    font-family: var(--mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    text-shadow: 0 0 12px var(--accent-soft);
    font-size: 1.05rem;
}
.brand-role { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-dim);
    border-left: 2px solid transparent;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-left-color: var(--accent);
}
.nav .section {
    margin: 14px 0 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-faint);
    font-family: var(--mono);
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 26px;
    border-bottom: 1px solid var(--border);
    background: rgba(12, 6, 24, 0.82);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .crumb { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-size: 0.85rem; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; color: var(--text-dim); }
.content { padding: 26px; max-width: 1280px; width: 100%; }

.app-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 26px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.site-foot {
    text-align: center;
    padding: 16px 20px 24px;
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.burger { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; }

/* ---------- Panels ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}
.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
    opacity: 0.7;
}

.panel-head h2 {
    color: var(--accent);
    text-shadow: 0 0 14px var(--glow);
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.panel-head h2, .panel-head h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

/* ---------- Stat cards ---------- */
.stat {
    background: linear-gradient(160deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); font-family: var(--mono); }
.stat .value { font-size: 1.8rem; font-family: var(--mono); color: var(--accent); margin-top: 8px; text-shadow: 0 0 18px var(--accent-soft); }
.stat .value.dim { color: var(--text); text-shadow: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
    text-align: left;
    padding: 12px 14px;
    background: var(--panel-2);
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 240, 255, 0.04); }
td.num, th.num { font-family: var(--mono); white-space: nowrap; }
.empty { padding: 30px; text-align: center; color: var(--text-faint); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid currentColor;
    white-space: nowrap;
}
.status-new { color: #22d3ee; background: rgba(34, 211, 238, 0.12); }
.status-unclassified { color: #fb923c; background: rgba(251, 146, 60, 0.14); }
.status-accepted { color: #a78bfa; background: rgba(167, 139, 250, 0.12); }
.status-in_progress { color: var(--warning); background: rgba(255, 210, 63, 0.12); }
.status-waiting { color: #e879f9; background: rgba(232, 121, 249, 0.12); }
.status-done { color: var(--accent); background: var(--accent-soft); }
.status-rejected { color: var(--danger); background: rgba(255, 46, 107, 0.12); }
.status-cancelled { color: var(--text-faint); background: rgba(150, 120, 255, 0.08); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border); }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 6px; font-family: var(--mono); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.92rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 110px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-dim); }
.checkbox input { width: auto; }
.hint { font-size: 0.75rem; color: var(--text-faint); margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid var(--border-accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn:hover { box-shadow: 0 0 18px var(--accent-soft); text-decoration: none; }
.btn-primary { background: var(--accent); color: #04120c; font-weight: 700; border-color: var(--accent); }
.btn-primary:hover { box-shadow: 0 0 22px var(--glow); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn-danger { border-color: rgba(255, 46, 107, 0.4); background: rgba(255, 46, 107, 0.1); color: var(--danger); }
.btn-danger:hover { box-shadow: 0 0 18px rgba(255, 46, 107, 0.35); }
.btn-sm { padding: 6px 12px; font-size: 0.74rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; border: 1px solid; display: flex; gap: 10px; }
.flash-success { color: var(--accent); background: var(--accent-soft); border-color: var(--border-accent); }
.flash-error { color: var(--danger); background: rgba(255, 46, 107, 0.08); border-color: rgba(255, 46, 107, 0.35); }
.flash-info { color: #22d3ee; background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.3); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 34px; position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo img { max-height: 56px; margin-bottom: 10px; }
.auth-title { text-align: center; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-size: 1.3rem; }
.auth-sub { text-align: center; color: var(--text-faint); font-size: 0.8rem; margin-bottom: 24px; }
.auth-card .field { margin-bottom: 16px; }

/* ---------- Public form ---------- */
.public-wrap { min-height: calc(100vh - 64px); display: flex; justify-content: center; padding: 40px 20px; }
.public-card { width: 100%; max-width: 680px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 34px; }
.public-head { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 24px; }
.public-head .project { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-size: 1.25rem; }
.public-head .company { color: var(--text-dim); margin-top: 6px; }
.success-mark { font-size: 3rem; color: var(--accent); text-align: center; margin-bottom: 10px; text-shadow: 0 0 24px var(--accent-soft); }

/* ---------- Detail lists ---------- */
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 10px 16px; font-size: 0.9rem; }
.dl dt { color: var(--text-faint); font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 2px; }
.dl dd { margin: 0; color: var(--text); white-space: pre-wrap; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 1px solid var(--border); }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent-soft); }
.timeline .t-time { font-size: 0.72rem; color: var(--text-faint); font-family: var(--mono); }
.timeline .t-text { font-size: 0.88rem; }

.comment { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; background: var(--panel-2); }
.comment.internal { border-left: 3px solid var(--warning); }
.comment .c-head { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-faint); margin-bottom: 6px; font-family: var(--mono); }
.comment .c-body { white-space: pre-wrap; }

.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.file-list li:last-child { border-bottom: none; }
.file-list a { word-break: break-all; }

.section-title { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); font-size: 0.8rem; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .field-wrap { min-width: 140px; flex: 1; }
.filter-bar label.field { margin-bottom: 5px; }

.pagination { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); }
.pagination .current { background: var(--accent-soft); border-color: var(--border-accent); color: var(--accent); }

.link-box { display: flex; gap: 10px; align-items: center; background: var(--bg-2); border: 1px dashed var(--border-accent); border-radius: 8px; padding: 12px 14px; margin-top: 10px; }
.link-box code { flex: 1; word-break: break-all; color: var(--accent); font-size: 0.85rem; }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 0.8rem; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (max-width: 960px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-side { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 50;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        width: 260px;
    }
    body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); }
    .burger { display: inline-block; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; }
    .dl dt { margin-top: 8px; }
    .auth-card, .public-card { padding: 24px; }
    h1 { font-size: 1.25rem; }
}
