:root {
    --bg: #0b0d12;
    --bg-soft: #11141b;
    --panel: rgba(24, 28, 37, 0.86);
    --panel-strong: rgba(19, 23, 31, 0.92);
    --panel-soft: rgba(255, 255, 255, 0.04);
    --text: #f3f6fb;
    --muted: #97a3b8;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.12);
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 18px 36px rgba(0, 0, 0, 0.28);
    --radius: 28px;
    --radius-sm: 18px;
    --brand: #7dd3fc;
    --brand-strong: #38bdf8;
    --accent: #60a5fa;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.16), transparent 24%),
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.12), transparent 24%),
        linear-gradient(180deg, #0a0c11 0%, #10141b 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
}

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

.auth-card {
    width: min(560px, 100%);
    padding: 28px;
    border-radius: 32px;
    background: linear-gradient(180deg, rgba(24, 28, 37, 0.94) 0%, rgba(14, 18, 24, 0.94) 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.auth-card h2 {
    margin: 0 0 12px;
    font-size: clamp(1.8rem, 2vw, 2.4rem);
    letter-spacing: -0.04em;
}

.auth-card p {
    margin: 0 0 24px;
    color: var(--muted);
    line-height: 1.6;
}

.content {
    width: min(1460px, calc(100% - 28px));
    margin: 0 auto;
    padding: 16px 0 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 16px;
    padding: 22px 24px;
    border-radius: 32px;
    background:
        linear-gradient(180deg, rgba(28, 33, 44, 0.92) 0%, rgba(18, 22, 30, 0.9) 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.topbar-intro {
    max-width: 840px;
}

.page-kicker,
.panel-meta {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-kicker {
    background: rgba(125, 211, 252, 0.1);
    color: #bdeafe;
    margin-bottom: 12px;
    border: 1px solid rgba(125, 211, 252, 0.12);
}

.topbar h1 {
    margin: 0;
    font-size: clamp(2rem, 2.6vw, 2.8rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
}

.topbar p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.55;
    max-width: 56ch;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.btn {
    border: 0;
    border-radius: 16px;
    padding: 12px 16px;
    min-height: 46px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    box-shadow: var(--shadow-soft);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #08111b;
    background: linear-gradient(135deg, #7dd3fc 0%, #60a5fa 100%);
}

.btn-secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
}

.btn-danger {
    color: #fff5f5;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

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

.dashboard-stack {
    display: grid;
    gap: 16px;
}

.section-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.section-tab {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: #cfe0f2;
    font-weight: 700;
    cursor: pointer;
}

.section-tab.active {
    color: #08111b;
    background: linear-gradient(135deg, #d7f2ff 0%, #7dd3fc 100%);
    border-color: transparent;
}

.insight-card {
    padding: 16px 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    display: grid;
    gap: 8px;
}

.insight-card span {
    color: var(--muted);
    font-size: 0.84rem;
}

.insight-card strong {
    font-size: 1.7rem;
    letter-spacing: -0.05em;
}

.insight-card-warn {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.18);
}

.stat-card,
.panel {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.stat-card {
    padding: 12px;
    min-height: 108px;
    position: relative;
    overflow: hidden;
    border-radius: 22px;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -18px -24px auto;
    width: 64px;
    height: 64px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.stat-icon-all { background: rgba(96, 165, 250, 0.18); color: #9cc9ff; }
.stat-icon-lead { background: rgba(125, 211, 252, 0.14); color: #bcecff; }
.stat-icon-order { background: rgba(167, 139, 250, 0.16); color: #d8c9ff; }
.stat-icon-delivery { background: rgba(251, 191, 36, 0.16); color: #ffd980; }
.stat-icon-ready { background: rgba(74, 222, 128, 0.16); color: #b8f5c8; }
.stat-icon-issue { background: rgba(248, 113, 113, 0.18); color: #ffc0c0; }
.stat-icon-reject { background: rgba(251, 146, 60, 0.16); color: #ffd1a0; }
.stat-icon-service { background: rgba(245, 208, 84, 0.16); color: #ffe59a; }

.stat-label {
    color: #d7e0ee;
    font-size: 0.7rem;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.stat-value {
    font-size: 1.75rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.panel {
    padding: 20px;
    background: linear-gradient(180deg, rgba(24, 28, 37, 0.92) 0%, rgba(16, 19, 26, 0.92) 100%);
}

.panel-records {
    overflow: hidden;
}

.quick-add-panel {
    margin-bottom: 16px;
}

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

.panel-header.compact {
    margin-bottom: 14px;
}

.panel-title h2,
.panel-title h3 {
    margin: 0;
    font-size: 1.22rem;
    letter-spacing: -0.03em;
}

.panel-title p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.5;
}

.panel-meta {
    color: #bfe9ff;
    background: rgba(125, 211, 252, 0.08);
    border: 1px solid rgba(125, 211, 252, 0.1);
}

.toolbar-card {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
}

.toolbar {
    display: grid;
    gap: 12px;
}

.toolbar-top {
    grid-template-columns: minmax(260px, 1.3fr) 220px;
    margin-bottom: 14px;
}

.toolbar-top-extended {
    grid-template-columns: minmax(260px, 1.3fr) 220px auto;
}

.field {
    display: grid;
    gap: 8px;
}

.field label,
.status-tabs-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9aa9bf;
}

.field input,
.field select,
.field textarea,
.status-select {
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field select,
.status-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color: var(--text);
    background-image:
        linear-gradient(45deg, transparent 50%, #9fb3c8 50%),
        linear-gradient(135deg, #9fb3c8 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

.field select option,
.status-select option {
    color: #f3f6fb;
    background: #1a1f29;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.status-select:focus {
    border-color: rgba(125, 211, 252, 0.34);
    box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.08);
    background: rgba(255, 255, 255, 0.07);
}

.status-tabs-wrap {
    display: grid;
    gap: 10px;
}

.quick-add-form {
    display: grid;
    gap: 12px;
    grid-template-columns: 1.2fr 1.2fr 220px 220px 220px 220px auto;
}

.quick-add-submit {
    align-self: end;
}

.toggle-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-top: 28px;
    color: var(--muted);
    font-size: 0.92rem;
}

.toggle-box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.quick-toggle-box {
    align-self: end;
}

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.quick-filter-chip {
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: #c5d0df;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.quick-filter-chip.active {
    color: #08111b;
    background: linear-gradient(135deg, #d4f1ff 0%, #7dd3fc 100%);
    border-color: transparent;
}

.bulk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(125, 211, 252, 0.08);
    border: 1px solid rgba(125, 211, 252, 0.12);
}

.bulk-copy {
    display: grid;
    gap: 4px;
}

.bulk-copy span {
    color: var(--muted);
    font-size: 0.88rem;
}

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

.bulk-controls input,
.bulk-controls select {
    min-height: 44px;
    border-radius: 14px;
    padding: 10px 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.status-tab {
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: #c5d0df;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.status-tab:hover {
    background: rgba(255, 255, 255, 0.07);
}

.status-tab.active {
    color: #0b1220;
    background: linear-gradient(135deg, #b6e8ff 0%, #7dd3fc 100%);
    border-color: transparent;
}

.table-surface {
    border-radius: 22px;
}

.table-headline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.table-headline strong {
    display: block;
    font-size: 1rem;
}

.table-headline span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.table-wrap {
    overflow: auto;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

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

thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(17, 20, 27, 0.98);
    color: #92a2b8;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

th,
td {
    padding: 15px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    vertical-align: top;
}

tbody tr {
    transition: background 0.18s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.record-row {
    cursor: pointer;
}

.record-row-deleted {
    opacity: 0.7;
}

.record-meta-line {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.record-alert-badge,
.record-delete-badge,
.record-flag-badge {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.record-alert-badge {
    background: rgba(251, 146, 60, 0.16);
    color: #ffd2a8;
}

.record-delete-badge {
    background: rgba(239, 68, 68, 0.16);
    color: #ffc0c0;
}

.record-flag-badge {
    background: rgba(96, 165, 250, 0.16);
    color: #bfdbfe;
}

.record-flag-badge-info {
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
}

.record-flag-badge-success {
    background: rgba(74, 222, 128, 0.16);
    color: #bbf7d0;
}

.record-flag-badge-danger {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
}

.cell-stack {
    display: grid;
    gap: 8px;
}

.inline-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.inline-input:focus {
    outline: none;
    border-color: rgba(125, 211, 252, 0.34);
    box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.08);
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-POVPRASEVANJE { background: rgba(96, 165, 250, 0.18); color: #b9d5ff; }
.status-OBDELAVA { background: rgba(59, 130, 246, 0.18); color: #98c0ff; }
.status-NAROCENO { background: rgba(167, 139, 250, 0.18); color: #dacdff; }
.status-DOBAVLJENO { background: rgba(251, 191, 36, 0.18); color: #ffe29f; }
.status-PREVZETO { background: rgba(74, 222, 128, 0.18); color: #baf4c7; }
.status-ZAVRNJENO { background: rgba(251, 146, 60, 0.18); color: #ffd0aa; }
.status-NAPAKA { background: rgba(248, 113, 113, 0.18); color: #ffc2c2; }
.status-PLACILA { background: rgba(45, 212, 191, 0.18); color: #acefe7; }
.status-ARHIV { background: rgba(148, 163, 184, 0.16); color: #d5dbe6; }
.status-B2B { background: rgba(129, 140, 248, 0.18); color: #d2d6ff; }
.status-B2B_ARHIV { background: rgba(139, 92, 246, 0.18); color: #decfff; }
.status-SERVIS { background: rgba(245, 208, 84, 0.18); color: #ffe89f; }

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

.icon-btn {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.active-inline-action {
    border-color: rgba(125, 211, 252, 0.32);
    background: rgba(125, 211, 252, 0.12);
}

.delivered-call-controls {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.delivered-call-controls-idle {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.delivered-call-controls-called {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.16) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-color: rgba(96, 165, 250, 0.22);
}

.delivered-call-controls-missed {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.16) 0%, rgba(245, 158, 11, 0.08) 100%);
    border-color: rgba(251, 191, 36, 0.2);
}

.delivered-call-controls-confirmed {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.16) 0%, rgba(34, 197, 94, 0.08) 100%);
    border-color: rgba(74, 222, 128, 0.22);
}

.delivered-call-controls-canceled {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.16) 0%, rgba(239, 68, 68, 0.08) 100%);
    border-color: rgba(248, 113, 113, 0.22);
}

.delivered-call-head {
    display: grid;
    gap: 3px;
}

.delivered-call-label {
    color: #eef6ff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.delivered-call-caption {
    color: var(--muted);
    font-size: 0.82rem;
}

.delivered-call-section {
    display: grid;
    gap: 6px;
}

.delivered-call-section-label {
    color: #c9d7e8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.delivered-call-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.call-action-btn {
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.call-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.call-action-btn.active {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.call-action-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.empty-state,
.loading-state {
    padding: 30px 18px;
    display: grid;
    place-items: center;
    gap: 10px;
    text-align: center;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--line-strong);
    border-radius: 22px;
}

.empty-state strong,
.loading-state strong {
    color: var(--text);
    font-size: 1rem;
}

.empty-state span,
.loading-state span {
    max-width: 34ch;
    line-height: 1.55;
}

.state-illustration {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(125, 211, 252, 0.1);
    color: #c4edff;
    border: 1px solid rgba(125, 211, 252, 0.12);
    font-weight: 800;
}

.activity-shell {
    border-radius: 22px;
}

.activity-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.activity-toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.activity-toolbar-copy {
    display: grid;
    gap: 4px;
}

.activity-toolbar-copy strong {
    font-size: 0.96rem;
}

.activity-toolbar-copy span {
    color: var(--muted);
    font-size: 0.9rem;
}

.activity-toolbar-btn {
    min-width: 140px;
}

.activity-list {
    display: grid;
    gap: 10px;
    max-height: 70vh;
    overflow: auto;
}

.activity-group {
    display: grid;
    gap: 10px;
}

.activity-group-header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.activity-group-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.activity-group-toggle:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
}

.activity-group-title-wrap {
    display: grid;
    gap: 4px;
    text-align: left;
}

.activity-group-title-wrap span {
    color: var(--muted);
    font-size: 0.85rem;
}

.activity-group-chevron {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(125, 211, 252, 0.12);
    color: #c7efff;
    font-weight: 800;
}

.activity-group-items {
    display: grid;
    gap: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.activity-item {
    padding: 15px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    transition: transform 0.18s ease, background 0.18s ease;
}

.activity-item:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
}

.activity-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}

.activity-item strong {
    display: inline-block;
    font-size: 0.95rem;
}

.activity-delete-btn {
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.18);
    background: rgba(239, 68, 68, 0.1);
    color: #ffc2c2;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.activity-delete-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.28);
    transform: translateY(-1px);
}

.activity-item p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.activity-time {
    display: block;
    margin-top: 8px;
    font-size: 0.82rem;
    color: #8796aa;
}

.table-help-btn {
    min-width: 180px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
    background: rgba(5, 8, 13, 0.72);
    backdrop-filter: blur(18px);
}

.modal.open {
    display: flex;
}

.modal-card {
    width: min(820px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 26px;
    border-radius: 30px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(24, 28, 37, 0.96) 0%, rgba(14, 17, 23, 0.96) 100%);
    box-shadow: var(--shadow);
}

.modal-card-activity {
    width: min(760px, 100%);
}

.modal-card-confirm {
    width: min(520px, 100%);
}

.modal-card-help {
    width: min(920px, 100%);
}

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

.modal-header h3 {
    margin: 6px 0 0;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
}

.modal-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

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

.help-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.help-card h4 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.help-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
    color: var(--muted);
    line-height: 1.55;
}

.help-list strong {
    color: var(--text);
}

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

.modal-grid .field.full {
    grid-column: 1 / -1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.close-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.08);
}

.confirm-body {
    display: grid;
    gap: 16px;
}

.confirm-body p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: rgba(239, 68, 68, 0.14);
    color: #ffb4b4;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 1.2rem;
    font-weight: 800;
}

.toast-wrap {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    box-shadow: var(--shadow-soft);
    animation: slide-up 0.25s ease;
}

.toast.success {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
}

.toast.error {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
}

.toast.warning {
    color: #fff7ed;
    background: linear-gradient(135deg, #9a3412 0%, #c2410c 100%);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1320px) {
    .stats-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .insight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-add-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 980px) {
    .toolbar-top,
    .modal-grid {
        grid-template-columns: 1fr;
    }

    .toolbar-top-extended {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        max-width: none;
    }

    .bulk-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-headline {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 760px) {
    .content {
        width: min(100% - 20px, 100%);
        padding: 12px 0 20px;
    }

    .topbar,
    .modal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .actions,
    .modal-actions {
        width: 100%;
    }

    .activity-toolbar,
    .activity-group-header,
    .activity-toolbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }

    .topbar,
    .panel,
    .modal-card {
        padding: 18px;
    }

    th,
    td {
        padding: 13px 12px;
    }

    .stat-card {
        min-height: 98px;
        padding: 12px;
    }
}
