:root {
  --ink: #0b0d10;
  --ink-2: #151921;
  --ink-3: #1e2530;
  --fog: #a7b0bd;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --panel: rgba(255, 255, 255, 0.03);
  --panel-2: rgba(255, 255, 255, 0.055);
  --snow: #f4f6f8;
  --red: #b40002;
  --red-2: #8d0002;
  --amber: #d8b36a;
  --ok: #5dbe8a;
  --danger: #ff6b6b;
  --radius: 18px;
  --font: "Manrope", "Segoe UI", sans-serif;
  --display: "Syne", "Arial Black", sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.app-body {
  font-family: var(--font);
  color: var(--snow);
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(180, 0, 2, 0.22), transparent 50%),
    radial-gradient(800px 400px at -10% 30%, rgba(216, 179, 106, 0.08), transparent 45%),
    linear-gradient(165deg, #090b0e 0%, #12161d 45%, #0b0d10 100%);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.app-hidden,
.login[hidden],
#viewLogin.app-hidden,
#viewApp.app-hidden,
#workspace.app-hidden {
  display: none !important;
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  animation: rise 480ms ease both;
}
.login[hidden] {
  display: none !important;
}
.login__card {
  width: min(420px, 100%);
  padding: 2rem 1.6rem 1.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.login__logo { width: 150px; display: block; margin-bottom: 1.4rem; filter: brightness(1.05); }
.login__title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.login__sub { margin: 0.7rem 0 1.4rem; color: var(--fog); line-height: 1.45; }
.field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fog); font-weight: 700; }
.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
  padding: 0.85rem 1rem;
}
.field input:focus { outline: 2px solid rgba(180,0,2,0.45); border-color: rgba(180,0,2,0.55); }
.login__error { color: var(--danger); min-height: 1.2rem; margin: 0 0 0.8rem; font-size: 0.9rem; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 16, 0.72);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; }
.brand img { width: 118px; display: block; }
.brand__text { display: grid; gap: 0.1rem; }
.brand__eyebrow { margin: 0; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fog); font-weight: 700; }
.brand__title { margin: 0; font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.03em; }
.top__right { display: flex; align-items: center; gap: 0.75rem; }
.user-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.75rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 0.9rem; font-weight: 650;
}
.user-chip__role {
  font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); font-weight: 800;
}

.btn {
  appearance: none; border: 1px solid transparent; border-radius: 999px;
  padding: 0.7rem 1.05rem; font-weight: 750; cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--red); color: #fff;
  box-shadow: 0 12px 28px rgba(180, 0, 2, 0.32);
}
.btn--primary:hover { background: var(--red-2); }
.btn--ghost {
  background: transparent; border-color: var(--line-strong); color: var(--snow);
}
.btn--ghost:hover { border-color: rgba(255,255,255,0.28); background: var(--panel); }
.btn--soft {
  background: var(--panel-2); border-color: var(--line); color: var(--snow);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Library ---------- */
.library {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 0;
  animation: rise 520ms ease both;
}
.rail {
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,0.18);
  padding: 1.1rem 0.85rem 2rem;
}
.rail__label {
  margin: 0 0.35rem 0.55rem;
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fog); font-weight: 800;
}
.rail__nav, .rail__cities { display: grid; gap: 0.25rem; }
.rail__nav { margin-bottom: 1.25rem; }
.rail__cities { max-height: calc(100vh - 260px); overflow: auto; }
.rail-btn {
  width: 100%; text-align: left; border-radius: 12px;
  border: 1px solid transparent; background: transparent;
  padding: 0.7rem 0.8rem; cursor: pointer; color: var(--snow);
}
.rail-btn:hover, .rail-btn.is-active {
  background: var(--panel-2); border-color: var(--line);
}
.rail-btn.is-active { box-shadow: inset 3px 0 0 var(--red); }
.rail-btn__count { float: right; color: var(--fog); font-size: 0.8rem; }
.city-btn {
  width: 100%; text-align: left; border-radius: 12px;
  border: 1px solid transparent; background: transparent;
  padding: 0.55rem 0.8rem; cursor: pointer; color: var(--snow); font-size: 0.92rem;
}
.city-btn:hover, .city-btn.is-active {
  background: var(--panel-2); border-color: var(--line);
}
.city-btn.is-active { box-shadow: inset 3px 0 0 var(--amber); }
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
  padding: 0.85rem 1rem;
}
.field select:focus { outline: 2px solid rgba(180,0,2,0.45); border-color: rgba(180,0,2,0.55); }

.main { padding: 1.25rem 1.4rem 2.5rem; min-width: 0; }
.main__head {
  display: flex; align-items: end; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.1rem;
}
.main__title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.main__sub { margin: 0.45rem 0 0; color: var(--fog); max-width: 38rem; line-height: 1.45; }
.toolbar { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 1rem; }
.search {
  flex: 1 1 240px; min-width: 200px;
  border: 1px solid var(--line-strong); background: rgba(0,0,0,0.25);
  border-radius: 999px; padding: 0.75rem 1rem;
}
.search:focus { outline: 2px solid rgba(180,0,2,0.4); }

.list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255,255,255,0.025);
}
.list__row, .row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 1fr 0.9fr 1fr;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  appearance: none;
  color: inherit;
  background: transparent;
  padding: 0.95rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  transition: background 140ms ease;
  animation: rise 420ms ease both;
}
.list__row:nth-child(1), .row:nth-child(1) { animation-delay: 40ms; }
.list__row:nth-child(2), .row:nth-child(2) { animation-delay: 70ms; }
.list__row:nth-child(3), .row:nth-child(3) { animation-delay: 100ms; }
.list__row:nth-child(4), .row:nth-child(4) { animation-delay: 130ms; }
.list__row:nth-child(5), .row:nth-child(5) { animation-delay: 160ms; }
.list__row:hover, .row:hover { background: rgba(180, 0, 2, 0.08); }
.list__row:last-child, .row:last-child { border-bottom: 0; }
.list__head {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 1fr 0.9fr 1fr;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--fog);
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 800;
  background: rgba(255,255,255,0.02);
}
.row__title, .list__title { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta, .list__meta { color: var(--fog); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__value, .list__date { font-variant-numeric: tabular-nums; color: var(--amber); font-weight: 700; justify-self: end; }
.list__code {
  justify-self: end; align-self: center;
  font-size: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--fog);
}
.empty, .status, .error {
  padding: 1.4rem 1rem; color: var(--fog);
}
.error { color: var(--danger); }

/* ---------- Workspace (3 columns) ---------- */
.workspace {
  position: fixed; inset: 0; z-index: 40;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(900px 420px at 100% 0%, rgba(180,0,2,0.18), transparent 50%),
    #0b0d10;
  animation: slideUp 360ms ease both;
}
.workspace__bar {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(11,13,16,0.92);
  backdrop-filter: blur(12px);
}
.workspace__meta { flex: 1; min-width: 0; }
.workspace__eyebrow {
  margin: 0; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fog); font-weight: 800;
}
.workspace__title {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  letter-spacing: -0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace__actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.workspace__body {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(280px, 340px);
  min-height: 0;
  overflow: hidden;
}
.panel {
  border-right: 1px solid var(--line);
  padding: 1rem 1.05rem 1.4rem;
  overflow: auto;
  background: rgba(255,255,255,0.02);
  min-height: 0;
}
.panel--hall {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  background: rgba(0,0,0,0.18);
}
.panel:last-child { border-right: 0; }
.panel__label {
  margin: 0 0 0.75rem;
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fog); font-weight: 800;
}
.stack { display: grid; gap: 0.7rem; }
.btn--sm { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem;
}
.kpi {
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.kpi__label { margin: 0; color: var(--fog); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.kpi__value {
  margin: 0.3rem 0 0;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}
.kpi__value--ok { color: var(--ok); }
.kpi__value--warn { color: var(--amber); }

.hall-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.hall-toolbar__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.hall-select {
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.35);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  max-width: 200px;
}
.hall-stage__frame {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01)),
    #0e1218;
  min-height: 0;
  padding: 0.85rem 0.75rem 1.1rem;
  overflow: auto;
  position: relative;
}
.hall-stage__screen {
  margin: 0 auto 1rem;
  width: min(70%, 420px);
  text-align: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--fog);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}
.hall-canvas {
  display: grid;
  gap: calc(0.32rem * var(--hall-zoom, 1));
  justify-content: center;
  padding: 0.25rem;
}
.seat-row {
  display: flex;
  gap: calc(0.22rem * var(--hall-zoom, 1));
  justify-content: center;
  align-items: center;
}
.seat-row--spacer { height: calc(0.55rem * var(--hall-zoom, 1)); }
.seat-row__label {
  width: calc(1.55rem * var(--hall-zoom, 1));
  color: var(--fog);
  font-size: calc(0.68rem * var(--hall-zoom, 1));
  font-weight: 700;
  text-align: right;
  flex: 0 0 auto;
}
.seat-row__label--right { text-align: left; }
.seat {
  position: relative;
  width: calc(26px * var(--hall-zoom, 1));
  height: calc(26px * var(--hall-zoom, 1));
  border-radius: calc(6px * var(--hall-zoom, 1));
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(180, 0, 2, 0.55);
  padding: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  line-height: 1;
  transition: transform 100ms ease, box-shadow 100ms ease, outline 100ms ease;
}
.seat:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
.seat.is-selected {
  outline: 2px solid #fff;
  outline-offset: 1px;
  z-index: 1;
}
.seat.is-disabled { opacity: 0.35; filter: grayscale(0.6); }
.seat--capacity {
  width: auto;
  min-width: calc(64px * var(--hall-zoom, 1));
  padding: 0 0.45rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
}
.seat__num {
  font-size: calc(0.62rem * var(--hall-zoom, 1));
  letter-spacing: -0.02em;
  pointer-events: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 1px;
}
.hall-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--fog); text-align: center; padding: 2rem; pointer-events: none;
}
.pricing-legend {
  display: flex; flex-wrap: wrap; gap: 0.55rem 0.85rem;
  color: var(--fog); font-size: 0.8rem;
}
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-item i {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
  border: 1px solid rgba(255,255,255,0.2);
}

.cost-editor { display: grid; gap: 0.35rem; }
.cost-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 28px;
  gap: 0.35rem;
  align-items: center;
}
.cost-edit-row__label,
.cost-edit-row__amt {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
}
.cost-edit-row__amt { text-align: right; font-variant-numeric: tabular-nums; }
.cost-edit-row__del {
  border: 0; background: transparent; color: var(--fog);
  cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0.2rem;
}
.cost-edit-row__del:hover { color: var(--danger); }

.cost-line {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.cost-line:last-child { border-bottom: 0; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1200px) {
  .workspace__body {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }
  .panel--right {
    grid-column: 1 / -1;
    border-right: 0;
    border-top: 1px solid var(--line);
    max-height: 40vh;
  }
}
@media (max-width: 900px) {
  .workspace__body { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel--hall { min-height: 50vh; }
  .panel--right { max-height: none; }
}
@media (max-width: 900px) {
  .library { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .rail__cities { max-height: 160px; }
  .list__head, .list__row, .row { grid-template-columns: minmax(0, 1fr) 90px; }
  .list__head span:nth-child(n+3),
  .list__row > :nth-child(n+3),
  .row > :nth-child(n+3) { display: none; }
  .brand__text { display: none; }
}
