:root {
  --bg: #090d12;
  --surface: #111821;
  --surface-2: #17212d;
  --surface-3: #202c39;
  --ink: #f4f7fb;
  --muted: #9aa8b6;
  --line: #293746;
  --brand: #21b7a8;
  --brand-dark: #168d82;
  --accent: #f2b94b;
  --danger: #ff4b4b;
  --ok: #49d17d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  margin: 0 auto;
  padding: 28px;
  width: min(100%, 430px);
}

.login-card h1 {
  font-size: clamp(1.8rem, 8vw, 3.1rem);
  line-height: 1;
  margin-bottom: 4px;
}

.login-card .primary-button {
  width: 100%;
}

.login-card .install-button {
  width: 100%;
}

.install-hint {
  background: rgba(33, 183, 168, 0.12);
  border: 1px solid rgba(33, 183, 168, 0.35);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0;
  padding: 10px 12px;
}

.login-error {
  color: #ff8a8a;
  font-weight: 900;
  margin: 0;
  min-height: 22px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.locked {
  display: none;
}

.sidebar {
  background: #070a0e;
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand-mark {
  align-items: center;
  background: var(--brand);
  border-radius: 8px;
  color: #04100f;
  display: inline-flex;
  font-weight: 900;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c9d4dd;
  padding: 12px 14px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: #fff;
}

.sidebar-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: auto;
  padding: 14px;
}

.sidebar-note span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 28px;
}

.topbar-actions,
.form-actions,
.row-actions {
  display: flex;
  gap: 10px;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.7rem, 2.5vw, 2.55rem);
  margin-bottom: 0;
}

h2 {
  font-size: 1.55rem;
  margin-bottom: 0;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0;
}

.primary-button,
.secondary-button,
.text-button,
.danger-button {
  border-radius: 8px;
  border: 0;
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  background: var(--brand);
  color: #031312;
  font-weight: 900;
}

.primary-button:hover {
  background: #34d4c3;
}

.secondary-button {
  background: var(--surface-3);
  color: var(--ink);
}

.text-button {
  background: transparent;
  color: var(--brand);
  font-weight: 900;
  padding: 0;
}

.danger-button {
  background: rgba(255, 75, 75, 0.16);
  color: #ff8a8a;
  font-weight: 900;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-title {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.today {
  color: var(--muted);
  font-size: 0.95rem;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric,
.order-form,
.table-wrap,
.alert-strip,
.production-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 1.85rem;
}

.alert-strip {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.alert-strip[hidden] {
  display: none;
}

.alert-strip.warning {
  animation: pulseYellow 1.8s infinite;
  border-color: rgba(242, 185, 75, 0.75);
}

.alert-strip.critical {
  animation: pulseRed 1s infinite;
  border-color: rgba(255, 75, 75, 0.85);
}

.production-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.production-card {
  display: grid;
  grid-template-rows: 190px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.production-card.warning {
  animation: pulseYellow 2.2s infinite;
}

.production-card.critical {
  animation: pulseRed 1.15s infinite;
}

.preview-thumb {
  align-items: center;
  background: #0d141b;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.preview-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.preview-thumb span {
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand);
  display: inline-flex;
  font-size: 2.1rem;
  font-weight: 900;
  height: 82px;
  justify-content: center;
  width: 82px;
}

.card-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.card-body header,
.card-body footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.order-id {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.countdown {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.countdown.warning {
  border-color: rgba(242, 185, 75, 0.7);
}

.countdown.critical {
  border-color: rgba(255, 75, 75, 0.85);
}

.countdown span,
.card-facts span {
  color: var(--muted);
}

.card-facts {
  display: grid;
  gap: 6px;
}

.check-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-check,
.check-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
}

.mini-check input,
.check-row input {
  accent-color: var(--brand);
  height: 17px;
  width: 17px;
}

.tag {
  background: var(--surface-3);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 5px 9px;
  white-space: nowrap;
}

.tag.production {
  background: rgba(73, 209, 125, 0.15);
  color: var(--ok);
}

.tag.waiting {
  background: rgba(242, 185, 75, 0.17);
  color: #ffd17b;
}

.tag.closed {
  background: rgba(154, 168, 182, 0.17);
  color: #c5d0da;
}

.filters {
  display: flex;
  gap: 10px;
}

.filters input,
.filters select {
  min-width: 220px;
}

input,
select,
textarea {
  background: #0d141b;
  border: 1px solid #334454;
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

input[readonly] {
  color: var(--brand);
  font-weight: 900;
}

input::placeholder,
textarea::placeholder {
  color: #687887;
}

textarea {
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: #d9e2ea;
}

td span {
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  justify-content: flex-end;
}

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.order-form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 18px;
}

legend {
  color: var(--ink);
  font-weight: 900;
  padding: 0 8px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-preview {
  align-items: end;
}

label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 800;
}

.conditional.hidden,
#printFields.hidden,
.hidden {
  display: none;
}

.preview-box {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: #0d141b;
  background-position: center;
  background-size: cover;
  border: 1px dashed #44596b;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 110px;
}

.form-actions {
  justify-content: flex-end;
}

.quote-form .form-actions {
  justify-content: flex-start;
}

.inline-action {
  align-self: end;
}

.line-items {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(9, 12, 18, 0.62);
}

.line-items:empty {
  display: none;
}

.line-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.cash-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.compact-form {
  margin-bottom: 18px;
}

.cash-table {
  margin-top: 18px;
}

.product-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin-top: 18px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 16px;
}

.product-card p {
  color: var(--muted);
  margin: 8px 0 0;
}

.product-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cash-in-row {
  background: rgba(73, 209, 125, 0.07);
}

.cash-out-row {
  background: rgba(255, 75, 75, 0.08);
}

.money-in {
  color: var(--ok);
  font-weight: 900;
}

.money-out {
  color: #ff8a8a;
  font-weight: 900;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed #44596b;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

@keyframes pulseYellow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(242, 185, 75, 0);
  }
  50% {
    box-shadow: 0 0 28px rgba(242, 185, 75, 0.35);
  }
}

@keyframes pulseRed {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 75, 75, 0);
  }
  50% {
    box-shadow: 0 0 34px rgba(255, 75, 75, 0.45);
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 18px;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .metrics,
  .cash-metrics,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .section-title,
  .filters,
  .alert-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .form-actions {
    flex-direction: column;
  }

  .production-grid,
  .metrics,
  .cash-metrics,
  .grid,
  .nav,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .topbar button,
  .form-actions button {
    width: 100%;
  }
}
