:root {
    --bg: #0b1220;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-2: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.12);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.65);
    --faint: rgba(255, 255, 255, 0.45);
    --brand: #7c4dff;
    --green: #23c96d;
    --yellow: #f5c542;
    --red: #ff5d5d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "PingFang SC",
        "Hiragino Sans GB",
        "Microsoft YaHei",
        "Helvetica Neue",
        Arial;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

body {
    position: relative;
    background: transparent;
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(1200px 700px at 20% 10%, rgba(124, 77, 255, 0.28), transparent 55%),
        radial-gradient(900px 700px at 85% 30%, rgba(35, 201, 109, 0.18), transparent 55%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    padding: 20px 16px;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.brand {
    padding: 10px 10px 8px;
    margin-bottom: 4px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.9), rgba(35, 201, 109, 0.6));
    box-shadow: var(--shadow);
}

.brand-title {
    font-weight: 700;
    line-height: 1.1;
}

.brand-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 14px;
}

.brand-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-username {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.brand-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.nav {
    display: grid;
    gap: 6px;
    padding: 0 6px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    color: var(--muted);
}

.nav a.active {
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.22), rgba(255, 255, 255, 0.08));
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav svg {
    width: 18px;
    height: 18px;
    opacity: 0.9;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    /* border-top: 1px solid var(--border); */
    color: var(--muted);
    font-size: 12px;
}

.main {
    padding: 22px 22px 40px;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#page {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.layout-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.toggle-button {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

.toggle-button.active {
    color: var(--text);
    border-color: rgba(124, 77, 255, 0.6);
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.2), rgba(124, 77, 255, 0.05));
}

.flow-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.18), rgba(255, 255, 255, 0.04));
    margin-bottom: 12px;
}

.flow-title {
    font-size: 18px;
    font-weight: 800;
}

.flow-desc {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.flow-current {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text);
}

.flow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.flow-step {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    font-size: 12px;
    color: var(--muted);
}

.flow-step.active {
    color: var(--text);
    border-color: rgba(124, 77, 255, 0.6);
    background: rgba(124, 77, 255, 0.2);
}

.flow-step.done {
    color: #eafff1;
    border-color: rgba(35, 201, 109, 0.4);
    background: rgba(35, 201, 109, 0.2);
}

.steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--muted);
}

.step-index {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.step.active {
    color: var(--text);
    border-color: rgba(124, 77, 255, 0.6);
    box-shadow: 0 0 0 1px rgba(124, 77, 255, 0.2);
}

.step.done .step-index {
    background: rgba(35, 201, 109, 0.35);
    color: #eafff1;
}

.step-label {
    font-size: 13px;
    font-weight: 600;
}

.summary-scroll-shell {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.summary-bar-scroll {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.summary-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 12px;
    min-width: max-content;
}

.summary-scroll-btn {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
}

.summary-scroll-btn svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.summary-item {
    flex: 0 0 320px;
    height: 115px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    overflow: auto;
}

.summary-item.is-danger {
    border-color: rgba(255, 93, 93, 0.45);
    background: rgba(255, 93, 93, 0.08);
}

.summary-label {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
    word-break: break-word;
}

.summary-value {
    font-size: 18px;
    font-weight: 800;
    margin-top: 6px;
    line-height: 1.5;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.file-name {
    color: var(--muted);
    font-size: 12px;
    flex: 1 1 auto;
    min-width: 160px;
}

.allocate-message.message-danger {
    color: #ffe0e0;
    font-weight: 600;
    padding: 10px 12px 10px 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.allocate-message.message-success {
    color: #dbffe9;
    font-weight: 600;
    padding: 10px 12px 10px 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.allocate-message.message-danger::before,
.allocate-message.message-success::before {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
}

.allocate-message.message-success::before {
    content: "✓";
    color: #ffffff;
    background: linear-gradient(180deg, #34d27a, #1fb765);
    border: 1px solid rgba(35, 201, 109, 0.65);
    box-shadow: 0 4px 10px rgba(35, 201, 109, 0.28);
}

.allocate-message.message-danger::before {
    content: "×";
    color: #ffffff;
    background: linear-gradient(180deg, #ff8b8b, #ff6666);
    border: 1px solid rgba(255, 107, 107, 0.55);
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.24);
}

.allocate-message:empty {
    display: none;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.split-layout.single-column {
    grid-template-columns: 1fr;
}

.overview-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    padding-bottom: 96px;
}

.overview-table-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.overview-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100vh - 340px);
    overflow: auto;
}

.users-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    padding-bottom: 96px;
}

.users-top-card {
    flex: 0 0 auto;
}

.users-split-section {
    flex: 0 0 auto;
}

.users-list-card,
.users-history-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.users-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 260px;
    overflow: auto;
    padding-top: 0;
}

.users-history-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding-top: 0;
}

.grow {
    flex: 1 1 auto;
}

.card-side-actions {
    min-width: 320px;
    position: relative;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.users-top-row {
    align-items: flex-start;
}

.users-top-controls {
    margin-top: 16px;
}

.compact-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.compact-inline .push-right {
    margin-left: auto;
}

.compact-inline-right {
    justify-content: flex-end;
}

.inline-note {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.import-template-tip {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    margin-right: 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #ffd7d7;
    background: rgba(255, 93, 93, 0.2);
    border: 1px solid rgba(255, 93, 93, 0.35);
}

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

.card-subsection {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card-title.small {
    font-size: 14px;
}

.alloc-toggle {
    margin-right: 8px;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 999px;
}

.alloc-details td {
    background: rgba(255, 255, 255, 0.03);
}

.alloc-subtable {
    margin-top: 8px;
}

.allocations-page {
    height: calc(100% - 90px);
    min-height: 0;
    overflow: hidden;
    padding-bottom: 96px;
}

.allocations-table-wrap {
    max-height: calc(100vh - 250px);
    overflow: auto;
    padding-top: 0;
}

.inline-header-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.inline-header-action button {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.allocation-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.allocation-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 12px;
}

.allocation-table {
    table-layout: fixed;
}

.allocation-package-cell {
    width: 34%;
    min-width: 260px;
}

.allocation-qty-cell {
    width: 120px;
}

.allocation-remark-cell {
    width: 220px;
}

.fixed-package {
    display: block;
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

.alloc-package,
.alloc-remark {
    width: 100%;
}

.alloc-qty {
    width: 96px;
}

.is-disabled {
    opacity: 0.65;
}

.is-disabled:hover {
    background: rgba(255, 93, 93, 0.05);
    cursor: not-allowed;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(6, 10, 18, 0.72);
    backdrop-filter: blur(4px);
}

.modal-card {
    width: min(760px, 94vw);
    max-height: 80vh;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    box-shadow: var(--shadow);
    padding: 20px;
}

.confirm-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.confirm-main {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls svg {
    height: 10px;
}

input,
select {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

button {
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--text);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.link-button {
    border: none;
    padding: 0;
    margin: 0 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: 12px;
    border-radius: 0;
}

.floating-footer {
    position: fixed;
    left: calc(260px + (100vw - 260px) / 2);
    transform: translateX(-50%);
    bottom: 48px;
    z-index: 20;
    width: min(720px, calc(100vw - 340px));
    min-height: 52px;
}

.floating-footer.single {
    display: flex;
    justify-content: center;
}

.floating-footer .floating-primary {
    min-width: 180px;
    box-shadow:
        0 0 18px rgba(255, 255, 255, 0.18),
        0 16px 36px rgba(0, 0, 0, 0.28);
}

.floating-footer:not(.single) .floating-primary {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.floating-footer:not(.single) #reset-draft {
    position: absolute;
    right: 0;
}

.floating-footer.is-sticky {
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(11, 18, 32, 0.9);
    border: 1px solid var(--border);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(12px);
}

.floating-footer.single.is-sticky {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

button.primary {
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.8), rgba(124, 77, 255, 0.35));
    border-color: rgba(124, 77, 255, 0.6);
}

button.danger {
    background: linear-gradient(135deg, rgba(255, 93, 93, 0.85), rgba(255, 93, 93, 0.25));
    border-color: rgba(255, 93, 93, 0.6);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.clickable {
    cursor: pointer;
}

.clickable:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.07);
}

.link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    padding: 10px 10px;
}

.timeline {
    display: grid;
    gap: 12px;
    position: relative;
}

.timeline-header {
    display: grid;
    gap: 4px;
    padding: 4px 2px 8px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.timeline-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text);
}

.timeline-header-label {
    color: var(--muted);
}

.timeline-header-arrow {
    color: var(--faint);
}

.timeline-axis,
.timeline-row {
    display: grid;
    grid-template-columns: minmax(160px, 230px) 1fr;
    gap: 12px;
    align-items: center;
}

.timeline-axis-label {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.timeline-axis-track {
    position: relative;
    height: 20px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.timeline-axis-track::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: 50%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.timeline-tick {
    position: absolute;
    top: -18px;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--faint);
    white-space: nowrap;
}

.timeline-tick::after {
    content: "";
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
}

.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
    padding-left: 2px;
    justify-content: center;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.legend-dot.online {
    background: rgba(35, 201, 109, 0.9);
}

.legend-dot.leave {
    background: rgba(88, 179, 255, 0.9);
}

.legend-dot.timeout {
    background: rgba(255, 93, 93, 0.9);
}

.timeline-rows {
    display: grid;
    gap: 10px;
}

.timeline-hover-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.timeline-hover-tip {
    position: absolute;
    transform: translateX(-50%);
    background: rgba(15, 22, 38, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 120ms ease;
}

.timeline-hover-info {
    margin-top: 6px;
    font-size: 11px;
    color: var(--faint);
}

.timeline-row {
    padding: 18px 10px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-row.teacher {
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.12), rgba(255, 255, 255, 0.03));
    border-color: rgba(124, 77, 255, 0.28);
}

.timeline-user-name {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.timeline-user-name.copyable {
    cursor: pointer;
}

.timeline-user-name.copyable::after {
    content: attr(data-user-id);
    position: absolute;
    left: 0;
    top: 22px;
    background: rgba(15, 22, 38, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 120ms ease;
}

.timeline-user-name.copyable:hover::after {
    opacity: 1;
}

.timeline-user-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.timeline-anomaly {
    margin-top: 6px;
    font-size: 12px;
    color: #ff8a8a;
}

.timeline-track {
    position: relative;
    height: 14px;
    border-radius: 999px;
    overflow: visible;
}

.timeline-seg {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}

.timeline-seg.online {
    background: linear-gradient(90deg, rgba(35, 201, 109, 0.95), rgba(35, 201, 109, 0.35));
}

.timeline-seg.leave {
    background: linear-gradient(90deg, rgba(88, 179, 255, 0.95), rgba(88, 179, 255, 0.35));
}

.timeline-seg.timeout {
    background: linear-gradient(90deg, rgba(255, 93, 93, 0.95), rgba(255, 93, 93, 0.35));
}

.timeline-bubble {
    position: absolute;
    top: -22px;
    transform: translateX(-50%);
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    white-space: nowrap;
}

.timeline-bubble.warn {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.45);
}

.timeline-bubble.repair {
    background: rgba(242, 201, 76, 0.2);
    border-color: rgba(242, 201, 76, 0.5);
}

.timeline-bubble.timeout {
    background: rgba(255, 93, 93, 0.2);
    border-color: rgba(255, 93, 93, 0.5);
}

.timeline-empty {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--faint);
}

@media (max-width: 980px) {
    .timeline-axis,
    .timeline-row {
        grid-template-columns: 1fr;
    }

    .timeline-axis-track {
        margin-top: 6px;
    }
}

.tabs {
    display: inline-flex;
    gap: 14px;
    align-items: center;
}

.tab {
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 0;
    border-bottom: 2px solid transparent;
    padding-bottom: 6px;
}

.tab.active {
    color: rgba(255, 255, 255, 0.92);
    border-bottom-color: rgba(124, 77, 255, 0.85);
}

.tab:hover {
    color: rgba(255, 255, 255, 0.92);
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.card-title {
    color: var(--muted);
    font-size: 16px;
    letter-spacing: 0.2px;
}

.card-value {
    font-size: 22px;
    font-weight: 800;
    margin-top: 6px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
    color: var(--muted);
}

.pill.ok {
    border-color: rgba(35, 201, 109, 0.35);
    color: rgba(35, 201, 109, 0.95);
}

.pill.warn {
    border-color: rgba(245, 197, 66, 0.35);
    color: rgba(245, 197, 66, 0.95);
}

.pill.bad {
    border-color: rgba(255, 93, 93, 0.35);
    color: rgba(255, 93, 93, 0.95);
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    min-width: 160px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.legend-label {
    min-width: 42px;
}

.legend-value {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.78);
    font-variant-numeric: tabular-nums;
}

.legend-percent {
    margin-left: 8px;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 10px;
}

.axis {
    position: relative;
    height: 14px;
    margin-top: 6px;
    color: var(--faint);
    font-size: 10px;
}

.axis-inner {
    position: relative;
    height: 14px;
}

.axis-tick {
    position: absolute;
    transform: translateX(-50%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sparkline {
    width: 100%;
    height: 44px;
    margin-top: 10px;
    opacity: 0.95;
}

.sparkline-svg {
    width: 100%;
    height: auto;
    display: block;
}

.sparkline-axis {
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.sparkline-grid {
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.sparkline-ytext {
    fill: rgba(255, 255, 255, 0.55);
    font-size: 8px;
    font-variant-numeric: tabular-nums;
}

.sparkline-half {
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 900px) {
    .sparkline-half {
        max-width: 100%;
    }
}

.sparkline-hit {
    pointer-events: all;
}

.chart-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 16, 30, 0.94);
    box-shadow: var(--shadow);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    transform: translate(-50%, -120%);
    opacity: 0;
    transition: opacity 80ms ease;
}

.chart-tooltip.visible {
    opacity: 1;
}

.chart-tooltip .tip-title {
    font-variant-numeric: tabular-nums;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th,
.table td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    text-align: left;
    font-size: 13px;
    color: var(--text);
}

.table th {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
    position: sticky;
    top: 0;
    z-index: 3;
    backdrop-filter: blur(8px);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.alloc-subtable th {
    z-index: 1;
}

.table tbody tr {
    background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:hover {
    background: rgba(124, 77, 255, 0.08);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-found {
    color: #e2d7ff;
    border-color: rgba(124, 77, 255, 0.45);
    background: rgba(124, 77, 255, 0.2);
}

.status-linked {
    color: #d6ffea;
    border-color: rgba(35, 201, 109, 0.45);
    background: rgba(35, 201, 109, 0.2);
}

.status-pending {
    color: #ffe9b0;
    border-color: rgba(245, 197, 66, 0.45);
    background: rgba(245, 197, 66, 0.2);
}

.status-unmatched {
    color: #ffd2d2;
    border-color: rgba(255, 93, 93, 0.45);
    background: rgba(255, 93, 93, 0.18);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
        monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.copyable {
    cursor: pointer;
}

.copyable .copy-icon {
    opacity: 0;
    margin-left: 6px;
    display: inline-flex;
    vertical-align: -3px;
    transition: opacity 120ms ease;
}

.copyable:hover .copy-icon {
    opacity: 0.75;
}

.copyable .copy-icon svg {
    width: 14px;
    height: 14px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

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

.hl {
    background: rgba(255, 205, 80, 0.2);
    color: rgba(255, 230, 160, 0.95);
    padding: 0 2px;
    border-radius: 3px;
}

.note {
    color: var(--faint);
    font-size: 12px;
    line-height: 1.5;
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toast {
    position: fixed;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(250, 252, 255, 0.98);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 12px 14px 12px 48px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
    min-width: 360px;
    max-width: min(560px, calc(100vw - 24px));
    display: none;
    position: fixed;
}

.toast::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    background: rgba(124, 77, 255, 0.14);
    border: 1px solid rgba(124, 77, 255, 0.28);
}

.toast.show {
    display: block;
}

.toast.is-success {
    background: rgba(246, 255, 249, 0.98);
}

.toast.is-error {
    background: rgba(255, 248, 248, 0.98);
}

.toast.is-warning {
    background: rgba(255, 252, 245, 0.98);
}

.toast.is-success::before {
    content: "✓";
    color: #ffffff;
    background: linear-gradient(180deg, #34d27a, #1fb765);
    border-color: rgba(35, 201, 109, 0.65);
    box-shadow: 0 4px 10px rgba(35, 201, 109, 0.28);
}

.toast.is-error::before {
    content: "×";
    color: #ffffff;
    background: linear-gradient(180deg, #ff8b8b, #ff6666);
    border-color: rgba(255, 107, 107, 0.55);
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.24);
}

.toast.is-warning::before {
    content: "!";
    color: #ffffff;
    background: linear-gradient(180deg, #ffcf66, #f5a623);
    border-color: rgba(245, 166, 35, 0.55);
    box-shadow: 0 4px 10px rgba(245, 166, 35, 0.22);
}

.toast-title {
    font-weight: 800;
    font-size: 14px;
    color: #18212f;
}
.toast-msg {
    color: rgba(24, 33, 47, 0.72);
    font-size: 13px;
    margin-top: 4px;
    white-space: pre-wrap;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(520px, 92vw);
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 40px;
    position: relative;
    overflow: hidden;
}

/* .login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(124, 77, 255, 0.9), rgba(35, 201, 109, 0.8));
} */

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

/* .login-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.95), rgba(35, 201, 109, 0.75));
    box-shadow: var(--shadow);
} */

.login-brand-text {
    display: grid;
    gap: 4px;
    text-align: center;
}

.login-brand-line {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.4px;
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 30px;
}

.login-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-top: 10px;
    margin-bottom: 30px;
    text-align: center;
}

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

.login-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    align-items: center;
}

.login-row input {
    width: 100%;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field .input {
    width: 100%;
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--muted);
}

.password-toggle.is-active {
    color: var(--text);
}

.password-toggle-text {
    font-size: 14px;
    line-height: 1;
}

.input-code {
    width: 70px;
    flex: 0 0 auto;
}

.input-phone {
    flex: 1 1 auto;
}

.login-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.login-tip {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    padding: 2px 0;
}

.settings-page {
    display: grid;
    gap: 16px;
}

.settings-tabs {
    display: inline-flex;
    gap: 6px;
    margin-top: 14px;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.settings-panel {
    margin-top: 16px;
}

.settings-tab {
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    transition:
        background 120ms ease,
        color 120ms ease,
        box-shadow 120ms ease;
}

.settings-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.settings-tab.active {
    color: #f8fbff;
    background: linear-gradient(180deg, rgba(124, 77, 255, 0.28), rgba(124, 77, 255, 0.16));
    box-shadow: inset 0 0 0 1px rgba(124, 77, 255, 0.28);
}

.settings-section {
    display: grid;
    gap: 14px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 700;
}

.settings-field,
.settings-form {
    display: grid;
    gap: 10px;
    max-width: 460px;
}

.settings-actions {
    display: flex;
    justify-content: flex-start;
}

@media (max-width: 980px) {
    .container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 10;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .nav {
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        overflow-x: auto;
        padding-bottom: 6px;
    }
    .steps,
    .summary-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .flow-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .flow-steps {
        justify-content: flex-start;
    }
    .split-layout {
        grid-template-columns: 1fr;
    }
    .card-side-actions {
        min-width: 0;
        width: 100%;
    }
    .floating-footer {
        left: 50%;
        width: min(720px, calc(100vw - 32px));
    }
    .allocation-table {
        table-layout: auto;
    }
    .allocation-package-cell,
    .allocation-qty-cell,
    .allocation-remark-cell {
        width: auto;
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .steps,
    .summary-bar {
        grid-template-columns: 1fr;
    }
    .floating-footer {
        bottom: 20px;
        width: calc(100vw - 24px);
    }
    .floating-footer:not(.single) {
        min-height: 108px;
    }
    .floating-footer:not(.single) .floating-primary,
    .floating-footer:not(.single) #reset-draft {
        position: static;
        transform: none;
        width: 100%;
    }
    .floating-footer.is-sticky,
    .floating-footer:not(.single) {
        display: grid;
        gap: 8px;
    }
    .confirm-row {
        flex-direction: column;
        align-items: stretch;
    }
}
