@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Georgian:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --bg-base:      #0d0d0f;
  --bg-surface:   #141416;
  --bg-elevated:  #1c1c20;
  --bg-hover:     #222226;
  --bg-active:    #28282e;
  --border:       rgba(255,255,255,0.07);
  --border-md:    rgba(255,255,255,0.11);
  --border-hi:    rgba(255,255,255,0.18);
  --text-primary: #f0eff2;
  --text-second:  #8b8a92;
  --text-muted:   #55545c;
  --accent:       #7c6aff;
  --accent-soft:  rgba(124,106,255,0.12);
  --accent-glow:  rgba(124,106,255,0.25);
  --green:        #22c55e;
  --green-soft:   rgba(34,197,94,0.1);
  --amber:        #f59e0b;
  --amber-soft:   rgba(245,158,11,0.1);
  --red:          #ef4444;
  --red-soft:     rgba(239,68,68,0.1);
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --sidebar-w:    230px;
  --transition:   .15s cubic-bezier(.4,0,.2,1);
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans Georgian', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── SCROLLBAR ──────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 99px; }

/* ─── LAYOUT ─────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 50;
}

.sidebar-top {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  display: flex; align-items: center; gap: 9px; margin-bottom: 2px;
}
.logo-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 16px; height: 16px; stroke: #fff; }
.logo-name { font-size: 14px; font-weight: 700; letter-spacing: .02em; color: var(--text-primary); }
.logo-sub  { font-size: 11px; color: var(--text-muted); padding-left: 39px; }

.nav { padding: 10px 10px; flex: 1; }
.nav-section { font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--text-muted); padding: 12px 8px 6px; text-transform: uppercase; }

.nav-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 10px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px;
  color: var(--text-second);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
  text-align: left;
}
.nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .6; transition: opacity var(--transition); }
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn:hover svg { opacity: .9; }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.nav-btn.active svg { opacity: 1; stroke: var(--accent); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px;
  max-width: 900px;
}

/* ─── PAGE ───────────────────────── */
.page { display: none; animation: fadeUp .2s ease; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ─── CARD ───────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 14px;
}
.card-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 18px;
}

/* ─── FORM ───────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fg { margin-bottom: 14px; }
.fg:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-second);
  margin-bottom: 6px; letter-spacing: .015em;
}
label .req { color: var(--accent); margin-left: 2px; }

input, select, textarea {
  width: 100%;
  font-family: inherit; font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  appearance: none;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-hi); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-active);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2355545c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
select option { background: var(--bg-elevated); }
textarea { resize: vertical; line-height: 1.7; min-height: 200px; font-size: 13.5px; font-family: 'DM Mono', monospace; }

/* ─── BUTTONS ────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap; line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover { background: #6b59ee; box-shadow: 0 0 16px var(--accent-glow); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { background: transparent; color: var(--text-second); border-color: var(--border-md); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hi); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(239,68,68,.25); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-icon { padding: 7px; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ─── WARRANTY LIST ──────────────── */
.w-list { display: flex; flex-direction: column; gap: 8px; }

.w-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color var(--transition), background var(--transition);
}
.w-item:hover { border-color: var(--border-md); background: var(--bg-elevated); }

.w-index {
  width: 28px; height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; font-family: 'DM Mono',monospace;
  color: var(--text-muted); flex-shrink: 0;
}
.w-body { flex: 1; min-width: 0; }
.w-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; }
.w-meta span { display: flex; align-items: center; gap: 3px; }
.w-meta svg { width: 10px; height: 10px; }
.w-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── SERVICE CENTER ─────────────── */
.sc-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.sc-item:hover { border-color: var(--border-md); }
.sc-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.sc-row  { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-second); margin-top: 3px; }
.sc-row svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--text-muted); }

/* ─── BADGE ──────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .02em;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-active  { background: var(--green-soft); color: var(--green); }
.badge-warn    { background: var(--amber-soft); color: var(--amber); }
.badge-expired { background: var(--red-soft);   color: var(--red);   }

/* ─── EDITOR TOOLBAR ─────────────── */
.editor-toolbar {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar .t-btn {
  padding: 5px 9px; font-size: 12px; font-family: 'DM Mono',monospace;
  background: transparent; color: var(--text-second); border: 1px solid var(--border-md);
  border-radius: 4px; cursor: pointer;
  transition: all var(--transition);
}
.editor-toolbar .t-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hi); }
#warranty-editor {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
  min-height: 260px;
}
.char-count { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 6px; font-family: 'DM Mono',monospace; }
.last-saved { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─── MODAL ──────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: min(490px, calc(100vw - 28px));
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: modalPop .18s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalPop { from { opacity:0; transform:scale(.94) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 4px; transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; display: block; }

/* ─── EMPTY ──────────────────────── */
.empty { text-align: center; padding: 56px 20px; }
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 22px; height: 22px; stroke: var(--text-muted); }
.empty-text { font-size: 14px; color: var(--text-muted); }

/* ─── DIVIDER ────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ─── TOAST ──────────────────────── */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  color: var(--text-primary);
  font-size: 13px; padding: 11px 18px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(10px);
  transition: all .22s ease; z-index: 999; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.toast.err .toast-dot { background: var(--red); }

/* ─── STAT ROW ───────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 24px; }
.stat {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat-val { font-size: 26px; font-weight: 700; font-family: 'DM Mono',monospace; letter-spacing: -.03em; }
.stat-lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ─── MOBILE ─────────────────────── */
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  .sidebar { width: 100%; position: static; bottom: auto; flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-top { border-bottom: none; border-right: 1px solid var(--border); flex-shrink: 0; }
  .logo-sub { display: none; }
  .nav { display: flex; flex-direction: row; padding: 6px 8px; }
  .nav-section { display: none; }
  .nav-btn span { display: none; }
  .nav-btn { padding: 8px 10px; }
  .sidebar-footer { display: none; }
  .main { margin-left: 0; padding: 20px 16px; max-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .shell { flex-direction: column; }
}

/* ─── TEMPLATE PAGE ──────────────────────────── */
.placeholder-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-family: 'DM Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border-md);
  color: var(--accent);
  padding: 3px 9px; border-radius: 4px;
  cursor: pointer; transition: all var(--transition);
}
.placeholder-chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.placeholder-chip .chip-desc { color: var(--text-muted); font-family: var(--font-sans); font-size:10px; margin-left:3px; }
