:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f0f5ff;
  --text: #111827;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #1f7a4d;
  --brand-2: #2563eb;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #b45309;
  --shadow: 0 14px 38px rgba(15, 23, 42, .08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid rgba(37,99,235,.42); outline-offset: 2px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar { background: #0f172a; color: #dbeafe; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 8px 10px 20px; }
.brand img { width: 34px; height: 34px; }
.brand b { color: #fff; font-size: 18px; }
.nav-title { font-size: 12px; color: #93a4bc; margin: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 7px; color: #dbeafe; font-size: 14px; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.main { min-width: 0; }
.topbar { height: 62px; background: rgba(255,255,255,.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: 0; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 22px 24px 48px; max-width: 1440px; }
.footer { padding: 0 24px 20px; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 18px; }
.card { padding: 16px; }
.hero { background: linear-gradient(135deg, #ffffff 0%, #edf7ff 56%, #eaf8ef 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: center; box-shadow: var(--shadow); }
.hero h2 { font-size: 34px; line-height: 1.14; margin: 0 0 12px; letter-spacing: 0; }
.hero p { margin: 0 0 18px; color: var(--muted); max-width: 620px; }
.hero-visual { background: #101827; color: #dbeafe; border-radius: var(--radius); padding: 16px; min-height: 240px; display: grid; gap: 10px; align-content: center; }
.metric { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.12); padding: 9px 0; }
.metric strong { color: #fff; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 7px; padding: 8px 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; line-height: 1.2; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15, 23, 42, .08); }
.btn.primary { background: var(--brand-2); color: white; border-color: var(--brand-2); }
.btn.success { background: var(--brand); color: white; border-color: var(--brand); }
.btn.danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { min-width: 36px; width: 36px; padding: 0; font-size: 20px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar.split { justify-content: space-between; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 13px; }
.compact-note { margin: -2px 0 12px; font-size: 13px; }
.field.check { align-content: end; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; min-height: 38px; }
.input, .select, textarea { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 7px; padding: 9px 10px; min-height: 38px; }
.input.compact, .select.compact { min-width: 120px; padding: 6px 8px; min-height: 32px; font-size: 13px; }
textarea { min-height: 96px; resize: vertical; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--line); padding: 3px 8px; font-size: 12px; color: var(--muted); background: #fff; }
.tag.ok { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.tag.warn { color: var(--warn); border-color: #fde68a; background: #fffbeb; }
.tag.danger { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.muted { color: var(--muted); }
.price { font-size: 24px; font-weight: 750; }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin: 10px 0; }
.price-row strong { font-size: 22px; color: var(--brand-2); }
.admin-entry { display: block; min-height: 110px; }
.admin-entry:hover { color: var(--brand-2); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 14px; border: 1px solid var(--line); border-radius: 7px; padding: 10px; background: #fff; }
.check-list label { color: var(--text); font-size: 13px; }
.table-wrap { overflow: auto; }
.empty { max-width: 560px; }
.loading-panel { min-height: 180px; display: grid; place-items: center; text-align: center; }
.spinner { width: 18px; height: 18px; border-radius: 999px; border: 2px solid rgba(37,99,235,.2); border-top-color: var(--brand-2); display: inline-block; animation: spin .8s linear infinite; }
.spinner.tiny { width: 14px; height: 14px; border-width: 2px; }
.bar-chart { height: 120px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; }
.chat-log { min-height: 260px; }
.chat-log p { background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; max-width: 860px; }
.chat-compose { margin-top: 12px; }
.compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
code.key { word-break: break-all; white-space: normal; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: transparent; padding: 10px 8px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.toast { position: fixed; right: 18px; bottom: 18px; background: #0f172a; color: white; border-radius: 7px; padding: 11px 14px; box-shadow: var(--shadow); z-index: 10; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(15,23,42,.48); display: grid; place-items: center; padding: 18px; }
.modal { width: min(880px, 100%); max-height: min(92vh, 860px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 28px 80px rgba(15,23,42,.22); }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 16px; }
.modal-actions { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.mobile-nav { display: none; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .content { padding: 16px; }
  .footer { padding: 0 16px 18px; }
  .hero { grid-template-columns: 1fr; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid, .compact-form { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; height: auto; min-height: 62px; gap: 12px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  th, td { min-width: 120px; }
  .btn { white-space: normal; }
}
@media (prefers-reduced-motion: no-preference) {
  .panel, .card, .btn, .modal { transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease; }
  .card:hover { transform: translateY(-1px); }
  .modal { animation: modal-in .16s ease-out; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
