:root {
  color-scheme: dark;
  --bg: #070914;
  --panel: rgba(15, 20, 38, .72);
  --panel-strong: rgba(19, 26, 48, .94);
  --border: rgba(255, 255, 255, .12);
  --text: #f7f8ff;
  --muted: #a5b0c8;
  --soft: #68718a;
  --accent: #75f4c8;
  --accent-2: #9b7cff;
  --danger: #ff6b8a;
  --warning: #ffd166;
  --ok: #65f0a3;
  --shadow: 0 22px 80px rgba(0, 0, 0, .38);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(117, 244, 200, .15), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(155, 124, 255, .17), transparent 30%),
    linear-gradient(135deg, #060713 0%, #0b1020 55%, #060813 100%);
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.orb {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(40px);
  opacity: .35;
  pointer-events: none;
  animation: float 12s ease-in-out infinite;
}
.orb-a { left: -120px; top: 130px; background: rgba(117, 244, 200, .28); }
.orb-b { right: -160px; bottom: 80px; background: rgba(155, 124, 255, .24); animation-delay: -4s; }

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 54px;
  position: relative;
  z-index: 1;
}

.panel {
  background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  border-radius: var(--radius);
}

.hero {
  padding: clamp(24px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,.11), transparent);
  transform: translateX(-120%);
  animation: sweep 5.5s ease-in-out infinite;
}
.hero > * { position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(32px, 5vw, 62px); line-height: .96; }
h2 { font-size: 22px; }
.subtext {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.75;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.health-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  color: var(--muted);
  background: rgba(255,255,255,.06);
  font-size: 13px;
  white-space: nowrap;
}
.health-badge.ok { color: var(--ok); border-color: rgba(101, 240, 163, .34); background: rgba(101, 240, 163, .08); }
.health-badge.warn { color: var(--warning); border-color: rgba(255, 209, 102, .34); background: rgba(255, 209, 102, .08); }
.health-badge.error { color: var(--danger); border-color: rgba(255, 107, 138, .34); background: rgba(255, 107, 138, .08); }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07101b;
  font-weight: 900;
  box-shadow: 0 15px 40px rgba(117, 244, 200, .19);
}
.btn.ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
}
.btn.danger { color: var(--danger); }
.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 50%;
  font-size: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  min-height: 142px;
}
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -.04em;
}
.stat-card::before {
  content: "";
  position: absolute;
  right: -45px;
  top: -55px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(117,244,200,.28), transparent 64%);
}

.toolbar {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 150px auto auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
}
.search-box input, select, label input, label select {
  width: 100%;
  color: var(--text);
  background: rgba(5, 8, 18, .55);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  outline: none;
}
.search-box input {
  border: 0;
  background: transparent;
  height: 48px;
}
select { height: 48px; padding: 0 14px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, .8fr);
  gap: 18px;
}
.table-panel, .activity-panel { padding: 22px; }
.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.muted { color: var(--muted); }
.table-wrap { overflow: auto; border-radius: 20px; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 870px;
}
th, td {
  padding: 15px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
}
tbody tr {
  transition: background .2s ease, transform .2s ease;
}
tbody tr:hover { background: rgba(255,255,255,.045); }
.phone-title { display: flex; flex-direction: column; gap: 4px; }
.phone-title strong { font-size: 15px; }
.phone-title small { color: var(--muted); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,.12);
}
.tag.in_stock { color: var(--ok); background: rgba(101,240,163,.08); border-color: rgba(101,240,163,.25); }
.tag.sold { color: #9cb7ff; background: rgba(90,132,255,.09); border-color: rgba(90,132,255,.25); }
.tag.reserved { color: var(--warning); background: rgba(255,209,102,.09); border-color: rgba(255,209,102,.25); }
.tag.repair { color: #ff9b6b; background: rgba(255,155,107,.09); border-color: rgba(255,155,107,.25); }
.action-row { display: flex; flex-wrap: wrap; gap: 7px; }
.mini-btn {
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.mini-btn:hover { background: rgba(255,255,255,.1); }
.empty, .empty-card { color: var(--muted); text-align: center; padding: 28px; }
.empty-card {
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 20px;
}
.timeline { display: grid; gap: 12px; max-height: 680px; overflow: auto; padding-right: 4px; }
.timeline-item {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}
.timeline-item strong { display: block; margin-bottom: 6px; }
.timeline-item small { color: var(--muted); line-height: 1.6; }
.amount-pos { color: var(--ok); }
.amount-neg { color: var(--warning); }

.modal {
  width: min(920px, calc(100% - 28px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}
.modal.small { width: min(520px, calc(100% - 28px)); }
.modal::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(12px); }
.modal-card {
  padding: 24px;
  background: linear-gradient(145deg, rgba(21, 28, 51, .98), rgba(9, 13, 28, .98));
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 30px;
  box-shadow: 0 30px 120px rgba(0,0,0,.62);
  animation: pop .22s ease both;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid.single { grid-template-columns: 1fr; }
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
label input, label select {
  height: 48px;
  padding: 0 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(15,20,38,.92);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.glow-in { animation: glowIn .7s ease both; }
.fade-up { animation: fadeUp .65s ease both; }
.delay-1 { animation-delay: .08s; }
.delay-2 { animation-delay: .16s; }

@keyframes float { 0%, 100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(22px, -18px, 0) scale(1.08); } }
@keyframes sweep { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes glowIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1080px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr 150px; }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .app-shell { width: min(100% - 20px, 1480px); padding-top: 12px; }
  .hero, .table-panel, .activity-panel { padding: 18px; border-radius: 22px; }
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-card { padding: 18px; border-radius: 22px; }
}
