/* ============================================================
   styles.css — Глобальные стили приложения «Учет услуг и продаж»
   Цветовая схема: тёмно-синяя база, бирюзовые акценты
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #21262d;
  --border:      #30363d;
  --text:        #e6edf3;
  --text-dim:    #8b949e;
  --accent:      #00d4aa;
  --accent-dark: #009e80;
  --amber:       #f0a500;
  --danger:      #e05252;
  --danger-dark: #a83838;
  --radius:      10px;
  --shadow:      0 8px 32px rgba(0,0,0,0.5);
  --glass:       rgba(255,255,255,0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Headings ─── */
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,212,170,0.35);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  transform: translateY(-1px);
}

.btn-amber {
  background: var(--amber);
  color: #000;
}
.btn-amber:hover:not(:disabled) {
  background: #d49200;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(240,165,0,0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-icon {
  padding: 6px;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 16px;
}

/* ─── Inputs ─── */
input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.18s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.15);
}
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 80px; }

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { opacity: 1; }

/* ─── Form group ─── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ─── Glassmorphism card ─── */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 20px;
}

/* ─── Table ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); }
thead th {
  padding: 11px 14px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-dim);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--glass); }
tbody td { padding: 10px 14px; vertical-align: middle; }

/* ─── Badge ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text-dim);
}
.badge-accent { background: rgba(0,212,170,0.15); color: var(--accent); }

/* ─── Top bar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-title {
  font-size: 1.1rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #00a8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar-subtitle { font-size: 12px; color: var(--text-dim); }

/* ─── Stat cards ─── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), #00a8ff);
}
.stat-card .stat-label { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-card .stat-unit { font-size: 13px; color: var(--text-dim); margin-left: 4px; }

/* ─── Tabs ─── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  background: var(--surface);
}
.tab-btn {
  padding: 13px 20px;
  background: transparent; border: none;
  color: var(--text-dim);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.18s;
}
.tab-btn::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.18s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); }
.tab-btn.active::after { transform: scaleX(1); }

.tab-panel { display: none; padding: 24px 28px; }
.tab-panel.active { display: block; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 560px; max-width: 95vw;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.15rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 22px; cursor: pointer; line-height: 1;
  padding: 4px; border-radius: 6px;
  transition: color 0.18s, background 0.18s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

/* ─── Notification ─── */
.notif {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
}
.notif.error { border-color: var(--danger); }
.notif.hide { animation: fadeOut 0.3s ease forwards; }

@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

/* ─── Misc ─── */
.flex-row { display: flex; align-items: center; gap: 10px; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-amber { color: var(--amber); }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.w-100 { width: 100%; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: rgba(0,212,170,0.06) !important; }

/* ─── Empty state ─── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px;
  color: var(--text-dim);
  gap: 12px;
}
.empty-state .empty-icon { font-size: 48px; }
.empty-state .empty-text { font-size: 15px; }
