:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #19212a;
  --muted: #647181;
  --line: #dde3ea;
  --brand: #111827;
  --accent: #d8aa3f;
  --accent-strong: #b48120;
  --ok: #16794b;
  --warn: #b45309;
  --danger: #b42318;
  --info: #176b87;
  --shadow: 0 18px 45px rgba(25, 33, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.86), rgba(17, 24, 39, 0.46)),
    url("https://images.unsplash.com/photo-1505373877841-8d25f7d46678?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.login-brand {
  color: #fff;
  padding: clamp(32px, 6vw, 76px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 360px;
}

.brand-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 22px;
}

.brand-logo,
.login-logo,
.portfolio-logo {
  display: block;
  object-fit: contain;
  background: #fff;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 6px;
}

.brand-logo.master-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 2px;
}

.login-logo {
  width: min(280px, 78vw);
  height: auto;
  border-radius: 8px;
  margin-bottom: 24px;
}

.master-login-logo {
  width: min(260px, 72vw);
  border-radius: 50%;
  padding: 4px;
}

.login-brand h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.92;
  letter-spacing: 0;
}

.login-brand p {
  max-width: 640px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.5;
}

.login-panel {
  background: var(--surface);
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.login-panel h2,
.section-title h2,
.panel h2 {
  margin: 0;
  font-size: 24px;
}

.login-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

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

.sidebar {
  background: var(--brand);
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.sidebar .brand-mark {
  width: 48px;
  height: 48px;
  margin: 0;
  color: #fff;
}

.brand-text strong {
  display: block;
  font-size: 18px;
}

.brand-text span,
.user-box span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border-radius: 6px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.user-box {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 16px;
  display: grid;
  gap: 12px;
}

.main {
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  gap: 22px;
  align-content: start;
}

.topbar,
.section-title,
.panel-head,
.quote-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.portfolio-hero {
  min-height: 310px;
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 42px);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.94), rgba(17, 24, 39, 0.64)),
    url("https://images.unsplash.com/photo-1505373877841-8d25f7d46678?auto=format&fit=crop&w=1600&q=80") center/cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: center;
}

.portfolio-hero h2 {
  max-width: 760px;
  margin: 18px auto 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

.portfolio-logo {
  width: min(330px, 86vw);
  border-radius: 8px;
  margin: 0 auto;
}

.settings-logo-preview {
  width: min(320px, 100%);
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.event-card {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 168px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.event-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.event-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(216, 170, 63, 0.42), var(--shadow);
}

.event-open {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.event-card strong,
.event-open strong {
  font-size: 20px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

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

.metric,
.panel,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  padding: 18px;
}

.panel-head {
  margin-bottom: 16px;
}

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

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

.field {
  display: grid;
  gap: 7px;
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-4 {
  grid-column: 1 / -1;
}

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

.check-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-transform: none;
  color: var(--ink);
}

.check-item input {
  width: auto;
  min-height: auto;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 11px 12px;
  min-height: 42px;
}

.table-input {
  min-width: 88px;
  max-width: 120px;
  min-height: 36px;
  padding: 7px 8px;
  text-align: right;
}

.money-input {
  min-width: 108px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(216, 170, 63, 0.32);
  border-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

.btn.primary {
  background: var(--accent);
  color: #20160a;
}

.btn.dark {
  background: var(--brand);
  color: #fff;
}

.btn.ghost {
  background: #eef2f6;
  color: var(--ink);
}

.btn.danger {
  background: #fee4e2;
  color: var(--danger);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f8fafc;
}

td.numeric,
th.numeric {
  text-align: right;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tag.ok {
  background: #dcfae6;
  color: var(--ok);
}

.tag.warn {
  background: #fef0c7;
  color: var(--warn);
}

.tag.danger {
  background: #fee4e2;
  color: var(--danger);
}

.tag.info {
  background: #e0f2fe;
  color: var(--info);
}

.tenant-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tenant-cell img {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.tenant-cell strong,
.tenant-cell span {
  display: block;
}

.tenant-cell span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

a.btn {
  text-decoration: none;
}

.quote-total {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.quote-total .amount {
  font-size: 30px;
  font-weight: 900;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(15, 23, 42, 0.48);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-card {
  width: min(720px, 100%);
  padding: 18px;
}

.notice {
  padding: 12px 14px;
  border-radius: 6px;
  background: #fff8e1;
  border: 1px solid #f1d188;
  color: #6d4b00;
}

.print-page {
  background: #fff;
  color: #111827;
  padding: 36px;
}

.print-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 3px solid #111827;
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.print-logo {
  display: block;
  width: 210px;
  max-width: 52vw;
  height: auto;
  object-fit: contain;
  margin-bottom: 10px;
}

.print-group {
  margin-top: 22px;
  break-inside: avoid;
}

.label-sheet {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4mm;
  background: #fff;
  padding: 8mm;
}

.asset-label {
  width: 5cm;
  height: 2cm;
  display: grid;
  grid-template-columns: 1.38cm minmax(0, 1fr);
  gap: 1.5mm;
  align-items: center;
  overflow: hidden;
  padding: 1.8mm 2.2mm;
  border: 0.45mm solid #111827;
  border-radius: 1cm;
  background:
    linear-gradient(90deg, rgba(216, 170, 63, 0.26), rgba(255, 255, 255, 0) 42%),
    #fff;
  color: #111827;
  break-inside: avoid;
  box-shadow: inset 0 0 0 0.45mm rgba(216, 170, 63, 0.72);
}

.label-brand {
  width: 1.18cm;
  height: 1.18cm;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0.35mm solid #d8aa3f;
  background: #fff7df;
  overflow: hidden;
}

.label-logo {
  max-width: 1cm;
  max-height: 1cm;
  object-fit: contain;
}

.label-main {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 0.8mm;
}

.barcode {
  width: 3.05cm;
  height: 0.9cm;
  fill: #111827;
  shape-rendering: crispEdges;
}

.label-code {
  display: block;
  width: 100%;
  font-size: 13px;
  line-height: 1;
  text-align: center;
  letter-spacing: 0;
  color: #111827;
  font-weight: 900;
  font-family: Arial, Helvetica, sans-serif;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav button {
    justify-content: center;
  }

  .metrics,
  .form-grid,
  .report-summary,
  .form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .login-panel {
    padding: 24px;
  }

  .topbar,
  .section-title,
  .panel-head,
  .quote-total {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .form-grid,
  .report-summary,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .field.span-2,
  .field.span-4 {
    grid-column: auto;
  }

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

  .actions .btn,
  .topbar .btn,
  .section-title .btn {
    width: 100%;
  }
}

@media print {
  @page {
    margin: 0.6cm;
  }

  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .print-page {
    padding: 0;
  }

  table {
    min-width: 0;
  }

  .label-sheet {
    padding: 0;
    gap: 2mm;
  }

  .asset-label {
    border: 0.45mm solid #111827;
    box-shadow: inset 0 0 0 0.45mm rgba(216, 170, 63, 0.72);
  }
}
