:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1f2937;
  --border: #243041;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --success: #16a34a;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: linear-gradient(180deg, #020617, #0f172a 24%, #111827 100%);
  color: var(--text);
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-bottom: 1px solid var(--border); background: rgba(2, 6, 23, 0.95);
  position: sticky; top: 0; backdrop-filter: blur(12px); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 18px; }
.brand-mark {
  position: relative; width: 86px; height: 86px; border-radius: 24px; overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.88));
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.06) inset, 0 0 28px rgba(56, 189, 248, 0.18), 0 18px 36px rgba(0, 0, 0, 0.35);
}
.brand-mark::before {
  content: ''; position: absolute; inset: -25%;
  background: conic-gradient(from 180deg, rgba(56, 189, 248, 0.0), rgba(56, 189, 248, 0.7), rgba(167, 139, 250, 0.35), rgba(132, 204, 22, 0.4), rgba(56, 189, 248, 0.0));
  filter: blur(16px); opacity: .85; animation: orbitGlow 7s linear infinite;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 1px; border-radius: 22px;
  background: radial-gradient(circle at 28% 22%, rgba(56, 189, 248, 0.18), transparent 42%), linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.92));
}
.logo {
  position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; object-position: left center;
  background: transparent; padding: 14px; filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.18));
}
.brand h1 { margin: 0; font-size: 1.35rem; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.topnav { display: flex; gap: 12px; flex-wrap: wrap; }
.topnav a, .button-link {
  color: var(--text); text-decoration: none; padding: 10px 14px;
  background: var(--panel-soft); border-radius: 12px; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
}
.button-link { background: linear-gradient(135deg, #0ea5e9, #2563eb); border: 0; font-weight: 700; }
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.card {
  background: rgba(17, 24, 39, 0.95); border: 1px solid var(--border); border-radius: 20px;
  padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); margin-bottom: 22px;
}
.narrow { max-width: 460px; margin: 40px auto; }
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.stats, .mini-stats { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 14px; width: 520px; }
.mini-stats { width: 100%; margin: 18px 0; }
.stat-box { background: var(--panel-soft); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.stat-box span { display: block; color: var(--muted); font-size: 0.9rem; }
.stat-box strong { display: block; margin-top: 6px; font-size: 1.2rem; }
.grid { display: grid; gap: 22px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid { display: grid; gap: 14px; }
.sale-grid, .contract-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 0.92rem; }
input, select, textarea, button {
  width: 100%; border-radius: 12px; border: 1px solid var(--border); background: #0b1220; color: var(--text);
  padding: 12px 14px; font: inherit;
}
button {
  background: linear-gradient(135deg, #0ea5e9, #2563eb); border: 0; cursor: pointer; font-weight: 700;
}
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: #cbd5e1; }
.flash-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.flash { padding: 14px 16px; border-radius: 14px; }
.flash.success { background: rgba(22, 163, 74, 0.18); border: 1px solid rgba(22, 163, 74, 0.5); }
.flash.error { background: rgba(220, 38, 38, 0.18); border: 1px solid rgba(220, 38, 38, 0.5); }
.accordion details { border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; padding: 12px 14px; background: #0b1220; }
.accordion summary { cursor: pointer; font-weight: 600; }
.edit-form { margin-top: 14px; }
.hint { color: var(--muted); font-size: 0.92rem; }
ul { color: var(--text); margin: 12px 0 0 18px; }
li { margin-bottom: 8px; }
.inline-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 6px; }
.actions-stack { display: flex; align-items: flex-start; justify-content: flex-end; }
.danger-button {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.compact-danger-form button,
.compact-danger-form .danger-button {
  padding: 8px 12px;
  min-height: 38px;
}
.danger-form { max-width: 240px; }
@media (max-width: 900px) {
  .two-columns, .sale-grid, .contract-edit-grid, .hero { grid-template-columns: 1fr; display: grid; }
  .stats, .mini-stats { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { display: grid; gap: 16px; }
  .actions-stack { justify-content: flex-start; }
}

@keyframes orbitGlow {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.06); }
  to { transform: rotate(360deg) scale(1); }
}


.brand-mark-future {
  isolation: isolate;
}
.brand-halo {
  position: absolute;
  inset: -18%;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 50%, rgba(56,189,248,.42), rgba(56,189,248,0) 58%);
  filter: blur(18px);
  z-index: 0;
}
.brand-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(transparent 95%, rgba(56,189,248,.14) 100%),
    linear-gradient(90deg, transparent 95%, rgba(56,189,248,.12) 100%);
  background-size: 16px 16px;
  opacity: .45;
  mask-image: radial-gradient(circle at center, black 50%, transparent 85%);
}
.chart-legend-note {
  margin: 0 0 10px;
  color: #cbd5e1;
  font-size: .9rem;
  padding: 10px 12px;
  border: 1px solid rgba(56,189,248,.18);
  border-radius: 12px;
  background: rgba(8, 15, 30, 0.7);
}
.line-chart-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.compact-label {
  min-width: 280px;
}
@media (max-width: 900px) {
  .line-chart-header {
    display: block;
  }
  .compact-label {
    min-width: 0;
    margin-top: 12px;
  }
}
