/* ========================================
   FSM Network - Server Hosting Finance Panel
   Modern Dark Theme
   ======================================== */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-hover: #252838;
    --border: #2a2d3a;
    --text-primary: #e4e6f0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6070;
    --accent: #6c5ce7;
    --accent-hover: #7e70f0;
    --accent-glow: rgba(108, 92, 231, 0.15);
    --green: #00d68f;
    --green-bg: rgba(0, 214, 143, 0.1);
    --red: #ff6b6b;
    --red-bg: rgba(255, 107, 107, 0.1);
    --yellow: #ffc048;
    --yellow-bg: rgba(255, 192, 72, 0.1);
    --blue: #4fc3f7;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== App Layout ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border);
}

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

.logo-icon {
    font-size: 24px;
    color: var(--accent);
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
}

/* ===== Top Bar ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 13px;
    width: 200px;
    transition: all var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Buttons ===== */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ===== Views ===== */
.view {
    display: none;
    padding: 24px 32px;
}

.view.active {
    display: block;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card.highlight {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card), var(--accent-glow));
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--green);
}

.stat-change.negative {
    color: var(--red);
}

.stat-change.neutral {
    color: var(--text-muted);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.table td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table-footer {
    padding: 12px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ===== Status Badges ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-green {
    background: var(--green-bg);
    color: var(--green);
}

.badge-yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge-red {
    background: var(--red-bg);
    color: var(--red);
}

.badge-blue {
    background: rgba(79, 195, 247, 0.1);
    color: var(--blue);
}

/* ===== Chart Container ===== */
.chart-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 200px;
    padding: 16px 0;
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(180deg, var(--accent), rgba(108, 92, 231, 0.4));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: all 0.4s ease;
    position: relative;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-bar-value {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.chart-bar-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== Filter Row ===== */
.filter-row {
    display: flex;
    gap: 8px;
}

.select-sm {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

.select-sm:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Users Grid ===== */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.user-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}

.user-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.user-email {
    font-size: 12px;
    color: var(--text-muted);
}

.user-email.blurred-email {
    filter: blur(5px);
    user-select: none;
    cursor: default;
}

.user-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.user-stat {
    text-align: center;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.user-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.user-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

/* ===== Servers List ===== */
.servers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: all var(--transition);
}

.server-card:hover {
    border-color: var(--accent);
}

.server-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.server-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.server-name {
    font-weight: 600;
    font-size: 15px;
}

.server-provider {
    font-size: 12px;
    color: var(--text-muted);
}

.server-cost {
    font-size: 20px;
    font-weight: 700;
}

.server-cost-label {
    font-size: 11px;
    color: var(--text-muted);
}

.server-card-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ===== Collapsible Cards ===== */
.card-collapsible .card-toggle {
    cursor: pointer;
    user-select: none;
}

.card-collapsible .card-toggle:hover {
    background: var(--bg-hover);
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -20px -20px 0;
    padding: 20px;
    margin-bottom: 0;
}

.card-collapsible.collapsed .card-toggle:hover {
    border-radius: var(--radius);
    margin-bottom: -20px;
}

.card-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-toggle-icon {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    display: inline-block;
}

.card-collapsible.collapsed .card-toggle-icon {
    transform: rotate(-90deg);
}

.card-toggle-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-toggle-summary {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.card-collapsible .card-body {
    transition: none;
}

.card-collapsible.collapsed .card-body {
    display: none;
}

.card-collapsible.collapsed .card-header {
    margin-bottom: 0;
}

/* ===== Server Abo-Kacheln ===== */
.server-abo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.server-abo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}

.server-abo-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.server-abo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.server-abo-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-abo-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.server-abo-name {
    font-weight: 600;
    font-size: 15px;
}

.server-abo-provider {
    font-size: 11px;
    color: var(--text-muted);
}

.server-abo-cost {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.server-abo-cost-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
}

.server-abo-users {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.server-abo-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: background var(--transition);
}

.server-abo-user:hover {
    background: var(--bg-hover);
}

.server-abo-user-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-abo-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: white;
}

.server-abo-user-name {
    font-weight: 500;
}

.server-abo-user-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-abo-user-amount {
    font-weight: 600;
    font-size: 13px;
}

.server-abo-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.server-abo-footer-total {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

/* ===== Modals ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal form {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.input {
    resize: vertical;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background var(--transition);
}

.checkbox-group label:hover {
    background: var(--bg-tertiary);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    padding: 4px;
    line-height: 1;
    transition: color var(--transition);
}

.password-toggle:hover {
    color: var(--text-primary);
}

.reminder-card {
    border: 1px solid var(--yellow);
    background: var(--yellow-bg);
}

.reminder-card .card-header h2 {
    color: var(--yellow);
}

.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 192, 72, 0.15);
}

.reminder-item:first-child {
    border-top: none;
}

.reminder-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.reminder-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.reminder-text strong {
    color: var(--yellow);
}

.reminder-servers {
    display: inline;
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 4px;
}

.reminder-servers::before {
    content: '(';
}

.reminder-servers::after {
    content: ')';
}

.reminder-link .reminder-text a {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
}

.reminder-link .reminder-text a:hover {
    text-decoration: underline;
}

.reminder-amount-group {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.reminder-multiplier {
    font-weight: 700;
    font-size: 14px;
    color: var(--red);
    background: var(--red-bg);
    padding: 2px 7px;
    border-radius: 6px;
}

.reminder-rate {
    font-size: 12px;
    color: var(--text-muted);
}

.reminder-equals {
    font-size: 12px;
    color: var(--text-muted);
}

.reminder-amount {
    font-weight: 600;
    color: var(--yellow);
    white-space: nowrap;
}

.reminder-total {
    border-top: 2px solid rgba(255, 192, 72, 0.3);
    background: rgba(255, 192, 72, 0.05);
}

.reminder-amount-total {
    font-size: 15px;
    color: var(--red);
}

/* ===== Debts View ===== */
.debts-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.debts-user-block {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.debts-user-block:first-child {
    border-top: none;
}

.debts-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.debts-user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.debts-user-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--red);
}

.debts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.debts-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.debts-table td {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.debts-table tbody tr:hover {
    background: var(--bg-hover);
}

.debts-months {
    font-size: 11px;
    color: var(--text-muted);
}

.debts-subtotal {
    font-weight: 600;
    color: var(--yellow);
}

.debts-table tfoot td {
    border-top: 2px solid var(--border);
    border-bottom: none;
    color: var(--text-primary);
}

.debts-table tfoot .debts-subtotal {
    color: var(--red);
    font-size: 14px;
}

.debts-grand-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 2px solid var(--red);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.debts-grand-total-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--red);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ===== Settings ===== */
.settings-form {
    max-width: 480px;
}

.settings-form .form-group {
    margin-bottom: 24px;
}

.danger-label {
    color: var(--red) !important;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 14px;
}

/* ===== Action Buttons in Table ===== */
.action-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.action-btn.delete:hover {
    color: var(--red);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar .logo-text,
    .sidebar .logo-sub,
    .sidebar .nav-item span:not(.nav-icon),
    .sidebar-footer span:not(.status-dot) {
        display: none;
    }
    .main-content {
        margin-left: 60px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .view {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .filter-row {
        flex-wrap: wrap;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* ===== Light Theme ===== */
body.light-mode {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e8eaf0;
    --border: #d1d5de;
    --text-primary: #1a1d27;
    --text-secondary: #4a4f63;
    --text-muted: #7c8298;
    --accent: #6c5ce7;
    --accent-hover: #5a4bd6;
    --accent-glow: rgba(108, 92, 231, 0.12);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.theme-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--accent);
}

.theme-toggle-icon {
    font-size: 16px;
    line-height: 1;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.view.active {
    animation: fadeIn 0.3s ease;
}

.modal {
    animation: fadeIn 0.2s ease;
}

/* ===== Admin Auth ===== */
body:not(.is-admin) .admin-only {
    display: none !important;
}

#btnAuth {
    border: 1px solid var(--border);
}

body.is-admin #btnAuth {
    border-color: var(--green);
    color: var(--green);
}

.login-error {
    color: var(--red);
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--green-bg);
    color: var(--green);
    margin-left: 8px;
}

/* ===== Fullscreen Login Screen ===== */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-screen.hidden {
    display: none;
}

.app.hidden {
    display: none !important;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeIn 0.4s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 16px;
}

.login-logo-text {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.login-logo-sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-submit {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    justify-content: center;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-width: 280px;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    font-size: 13px;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toastIn 0.3s ease forwards;
    border-left: 4px solid var(--accent);
}

.toast.toast-success { border-left-color: var(--green); }
.toast.toast-error { border-left-color: var(--red); }
.toast.toast-warning { border-left-color: var(--yellow); }
.toast.toast-info { border-left-color: var(--accent); }

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}
