:root {
  --green: #0f766e;
  --blue: #223d91;
  --red: #dc2626;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f7fb;
  --panel: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
body.owner-locked .owner-shell, body.owner-locked .owner-nav { display: none; }

.auth-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
  background: linear-gradient(145deg, var(--green), var(--blue));
}
.auth-card, .owner-card, .profile-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
}
.auth-card {
  display: grid;
  gap: 16px;
  width: min(100%, 390px);
  padding: 24px;
}
.auth-brand { text-align: center; }
.auth-brand strong, .auth-brand span { display: block; }
.auth-brand strong { color: var(--green); font-size: 24px; }
.auth-brand span, .auth-card small { color: var(--muted); font-weight: 800; }
.auth-card label, .edit-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 900; }
.auth-card input, .edit-form input, .edit-form select {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 800;
}
.auth-card button, .edit-form button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}
.auth-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; font-weight: 900; }

.owner-shell { width: min(100%, 460px); min-height: calc(100vh - 72px); margin: 0 auto; padding-bottom: 16px; }
.owner-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}
.owner-top strong, .owner-top span { display: block; }
.owner-top span { opacity: .82; font-size: 12px; font-weight: 800; }
.owner-top button, .section-head button, .section-title button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--green);
  background: #fff;
  font-weight: 900;
}
.owner-view { display: none; padding: 14px; }
.owner-view.active { display: grid; gap: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric {
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}
.metric span, .record span, .profile-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.metric strong { display: block; margin-top: 6px; color: var(--green); font-size: 22px; }
.owner-card { padding: 14px; }
.section-head, .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.record-list { display: grid; gap: 10px; margin-top: 10px; }
.record {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.record strong { font-size: 15px; }
.record-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.record-actions button, .tab-row button, .profile-row {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 900;
}
.record-actions .danger, .profile-row.danger { color: var(--red); background: #fff5f5; }
.tab-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tab-row button { font-size: 12px; padding: 0 4px; }
.tab-row button.active { color: #fff; background: var(--green); }
.edit-form { display: grid; gap: 12px; }
.profile-row { width: 100%; padding: 0 14px; text-align: left; }
.owner-nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: min(100%, 460px);
  min-height: 72px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: #fff;
}
.owner-nav button { border: 0; color: var(--muted); background: transparent; font-size: 10px; font-weight: 900; }
.owner-nav button.active { color: var(--green); }
.pdf-actions { display: grid; gap: 10px; }
.pdf-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}
.owner-invoice-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
}
.owner-invoice-sheet h1,
.owner-invoice-sheet h2 { margin: 0; text-align: center; }
.owner-invoice-sheet h1 { color: var(--blue); font-size: 20px; }
.owner-invoice-sheet h2 { margin-top: 4px; color: var(--green); font-size: 16px; }
.owner-invoice-sheet table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font-size: 12px;
}
.owner-invoice-sheet th,
.owner-invoice-sheet td {
  border: 1px solid #1e3a8a;
  padding: 7px;
  text-align: left;
  vertical-align: top;
}
.owner-invoice-sheet th { color: #fff; background: #223d91; }
.invoice-total-row td { font-weight: 900; }
#invoicePdfView .invoice-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
}
#ownerToast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 40;
  transform: translateX(-50%) translateY(16px);
  width: min(380px, calc(100% - 32px));
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: #111827;
  text-align: center;
  font-weight: 900;
  opacity: 0;
  transition: .2s ease;
  pointer-events: none;
}
#ownerToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media print {
  body { background: #fff; }
  .owner-top,
  .owner-nav,
  .no-print,
  .owner-view:not(.invoice-print-view) {
    display: none !important;
  }
  .owner-shell,
  .owner-view.active {
    display: block;
    width: 100%;
    min-height: auto;
    padding: 0;
  }
  .owner-invoice-sheet {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }
  #invoicePdfView .invoice-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
  }
}

/* 2026-06-30 premium owner mobile refresh */
:root {
  --green: #0f766e;
  --blue: #1e3a8a;
  --red: #b91c1c;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --bg: #eef4f8;
  --panel: #ffffff;
}

body {
  background:
    linear-gradient(180deg, #dcebf4 0, #f7fafc 42%, #eef4f8 100%);
  overflow-x: hidden;
}

.auth-view {
  background: linear-gradient(145deg, #0f766e, #1e3a8a);
}

.auth-card,
.owner-card,
.profile-row,
.record,
.metric {
  border-color: rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.owner-shell {
  width: 100%;
  background: transparent;
}

.owner-top {
  min-height: 72px;
  background: linear-gradient(135deg, #0f172a, #0f766e 54%, #1e3a8a);
}

.owner-top strong {
  font-size: 19px;
}

.owner-top button,
.section-head button,
.section-title button {
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.metric {
  border-top: 4px solid #0f766e;
}

.metric strong {
  color: #075985;
  font-size: 21px;
}

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

.quick-grid button {
  min-height: 86px;
  border: 1px solid rgba(14, 116, 144, 0.2);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  color: #0f172a;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.quick-grid b,
.quick-grid span {
  display: block;
}

.quick-grid b {
  color: #0f766e;
  font-size: 15px;
}

.quick-grid span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 800;
}

.owner-card {
  border-top: 4px solid #0f766e;
}

.record {
  border-left: 4px solid #1e3a8a;
}

.record-actions button,
.tab-row button,
.profile-row {
  background: #f8fafc;
}

.record-actions button:first-child {
  color: #0f766e;
}

.record-actions .danger,
.profile-row.danger {
  border-color: #fecaca;
}

.owner-nav {
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  min-height: 76px;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.08);
}

.owner-nav button {
  min-width: 0;
  overflow: hidden;
  padding: 0 1px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9.5px;
}

.pdf-actions button {
  background: linear-gradient(135deg, #0f766e, #1e3a8a);
}

.desktop-feature-list span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 800;
}

#invoicePdfView .owner-invoice-sheet,
#cratePrintView .owner-invoice-sheet {
  overflow-x: auto;
}

#invoicePdfView .invoice-sheet,
#cratePrintView .report-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
}

@media print {
  body {
    overflow: visible;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }

  #invoicePdfView .owner-invoice-sheet,
  #cratePrintView .owner-invoice-sheet {
    overflow: visible;
  }

  #invoicePdfView .invoice-sheet,
  #cratePrintView .report-sheet {
    width: 210mm !important;
    min-height: 297mm !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
}
