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

:root {
  --bg: #0d0d14; --bg2: #13131e; --bg3: #1a1a28;
  --border: rgba(255,255,255,0.08);
  --text: #f0f0f8; --text2: #9090b0; --text3: #5a5a80;
  --primary: #7c6af5; --primary-dim: rgba(124,106,245,0.15);
  --green: #22d46e; --green-dim: rgba(34,212,110,0.12);
  --yellow: #f5b731; --yellow-dim: rgba(245,183,49,0.12);
  --red: #f55a5a; --red-dim: rgba(245,90,90,0.12);
  --blue: #4a9eff;
  --radius: 10px; --radius-sm: 6px;
}

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; min-height: 100vh; }

.app { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.header { grid-column: 1/-1; background: var(--bg2); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; }
.header__logo { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.header__user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); }
.header__logout { background: none; border: 1px solid var(--border); color: var(--text2); padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.header__logout:hover { color: var(--text); border-color: var(--text3); }

.sidebar { background: var(--bg2); border-right: 1px solid var(--border); padding: 12px 0; }
.sidebar__label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; padding: 10px 20px 4px; }
.sidebar__item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 1px 8px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text2); font-size: 13px; transition: all 0.15s; }
.sidebar__item:hover { background: var(--bg3); color: var(--text); }
.sidebar__item.active { background: var(--primary-dim); color: var(--primary); }
.sidebar__item-icon { font-size: 15px; width: 20px; text-align: center; }
.sidebar__badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; min-width: 18px; text-align: center; }

.main { padding: 24px; overflow-y: auto; background: var(--bg); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card__label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.stat-card__value { font-size: 30px; font-weight: 800; }
.stat-card__sub { font-size: 11px; color: var(--text3); margin-top: 4px; }
.stat-card--green .stat-card__value { color: var(--green); }
.stat-card--yellow .stat-card__value { color: var(--yellow); }
.stat-card--purple .stat-card__value { color: var(--primary); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.page-header__title { font-size: 20px; font-weight: 700; }
.page-header__sub { font-size: 12px; color: var(--text3); margin-top: 3px; }

.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 11px 16px; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); background: var(--bg3); font-weight: 600; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,0.015); cursor: pointer; }
.order-num { color: var(--text); font-weight: 600; font-family: monospace; font-size: 13px; }
.client-name { color: var(--text); font-weight: 500; }
.amount { color: var(--green); font-weight: 600; }

.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.status::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; }
.status--new { background: var(--primary-dim); color: var(--primary); }
.status--confirmed { background: rgba(74,158,255,0.12); color: var(--blue); }
.status--in_progress { background: var(--yellow-dim); color: var(--yellow); }
.status--ready { background: var(--green-dim); color: var(--green); }
.status--delivered { background: rgba(255,255,255,0.06); color: var(--text3); }
.status--cancelled { background: var(--red-dim); color: var(--red); }

.status-select { background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.status-select:focus { outline: none; border-color: var(--primary); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: #6a58e0; }
.btn--ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--bg3); color: var(--text); }
.btn--sm { padding: 5px 10px; font-size: 12px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 360px; }
.login-card__logo { text-align: center; font-size: 36px; margin-bottom: 8px; }
.login-card__title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-card__sub { text-align: center; font-size: 13px; color: var(--text3); margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.field__input { width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.field__input:focus { outline: none; border-color: var(--primary); }
.login-error { color: var(--red); font-size: 12px; text-align: center; margin: 0 0 12px; display: none; }
.login-error.show { display: block; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-overlay.show { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); width: 540px; max-height: 88vh; overflow-y: auto; }
.modal__header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close { background: none; border: none; color: var(--text3); font-size: 22px; cursor: pointer; line-height: 1; }
.modal__body { padding: 20px 24px; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; gap: 16px; }
.detail-row:last-child { border-bottom: none; }
.detail-row__label { color: var(--text3); flex-shrink: 0; }
.detail-row__value { color: var(--text); font-weight: 500; text-align: right; word-break: break-word; }
.modal__footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

.filter-bar { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; transition: all 0.15s; }
.filter-btn.active { background: var(--primary-dim); border-color: var(--primary); color: var(--primary); }
.filter-btn:hover:not(.active) { border-color: var(--text3); color: var(--text); }

.empty { text-align: center; padding: 60px 20px; }
.empty__icon { font-size: 40px; margin-bottom: 12px; }
.empty__text { color: var(--text3); font-size: 14px; }

.loading { text-align: center; padding: 48px; }
.spinner { display: inline-block; width: 26px; height: 26px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 10px 20px; border-radius: var(--radius); font-size: 13px; opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 200; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
