:root {
  --bg: #f6f3ed;
  --panel: #fffdf8;
  --ink: #20211e;
  --muted: #6f726b;
  --line: #ded8cc;
  --brand: #1f6f62;
  --brand-dark: #15544a;
  --accent: #c7502f;
  --gold: #aa7a27;
  --ok: #2f7d4f;
  --warn: #a65b20;
  --danger: #b64237;
  --shadow: 0 16px 40px rgba(52, 49, 42, 0.1);
}

/* Arcade app theme */
:root {
  --bg: #0f1720;
  --panel: #f7fbff;
  --ink: #17202a;
  --muted: #475569;
  --line: #111827;
  --brand: #17c3b2;
  --brand-dark: #0f766e;
  --accent: #3b82f6;
  --gold: #facc15;
  --ok: #16c784;
  --warn: #ff9f1c;
  --danger: #ef233c;
  --shadow: 0 7px 0 #111827, 0 18px 28px rgba(0, 0, 0, 0.2);
}

body {
  background:
    radial-gradient(circle at 12% 10%, rgba(23, 195, 178, 0.28), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(59, 130, 246, 0.24), transparent 28%),
    linear-gradient(180deg, #132033 0%, #0f1720 52%, #111827 100%);
}

.topbar {
  background: rgba(247, 251, 255, 0.96);
  border-bottom: 4px solid #111722;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.22);
}

.brand-mark {
  border: 3px solid #111722;
  border-radius: 14px;
  background: linear-gradient(180deg, #8be9dc, #17c3b2);
  color: #111722;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
  box-shadow: 0 5px 0 #111722;
}

.brand h1 {
  font-weight: 900;
}

.device-label,
.pill {
  border: 2px solid #111722;
  background: #dff9f5;
  color: #111722;
  font-weight: 900;
  box-shadow: 0 3px 0 #111722;
}

.layout {
  background: transparent;
}

.sidebar {
  background: rgba(18, 25, 34, 0.94);
  border-right: 4px solid #111722;
}

.nav-button {
  border: 2px solid transparent;
  color: #fff8df;
  font-weight: 900;
}

.nav-help {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 2px solid rgba(255, 248, 223, 0.6);
  border-radius: 12px;
  color: #fff8df;
  font-size: 12px;
  line-height: 1.35;
}

.nav-help strong {
  font-size: 14px;
}

.nav-button.active,
.nav-button:hover {
  border-color: #111722;
  background: #dff9f5;
  color: #111722;
  box-shadow: 0 5px 0 #111722;
}

.content {
  color: var(--ink);
}

.screen-title h2 {
  color: #17202a;
  font-weight: 1000;
  text-shadow: none;
}

.screen-title p {
  color: #334155;
  font-weight: 800;
}

.card {
  border: 4px solid #111722;
  background: var(--panel);
  color: var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.status-column {
  background: #eef8ff;
}

.status-column:nth-child(1) {
  background: #e0f7ff;
}

.status-column:nth-child(2) {
  background: #fff4c7;
}

.status-column:nth-child(3) {
  background: #ddfbea;
}

.status-column:nth-child(4) {
  background: #ffe3e3;
}

.status-column:nth-child(5) {
  background: #eee6ff;
}

.section-title h3 {
  font-weight: 1000;
}

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

.doc-actions .btn {
  min-height: 46px;
}

.doc-meta {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-weight: 800;
  line-height: 1.5;
}

.case-card-button,
.row,
.mini-kpi,
.calendar-day,
.field input,
.field select,
.field textarea {
  border: 3px solid #111722;
  border-radius: 12px;
  background: #fffdf1;
  box-shadow: 0 5px 0 #111722;
}

.case-card-button {
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.case-card-button:hover {
  transform: translateY(-2px);
  background: #fff7c7;
  box-shadow: 0 8px 0 #111722;
}

.case-card-button strong,
.row h4 {
  font-weight: 1000;
}

.btn,
.tab.active {
  border: 3px solid #111722;
  border-radius: 12px;
  background: linear-gradient(180deg, #8be9dc, #17c3b2);
  color: #111722;
  font-weight: 1000;
  box-shadow: 0 5px 0 #111722;
}

.btn:hover,
.tab.active:hover {
  background: linear-gradient(180deg, #a7fff3, #20d6c5);
}

.btn.secondary,
.tab {
  border: 3px solid #111722;
  border-radius: 12px;
  background: #eaf8ff;
  color: #10202c;
  font-weight: 1000;
  box-shadow: 0 5px 0 #111722;
}

.btn.danger {
  background: #ef233c;
  color: #fff;
}

.table th {
  color: #27313f;
  font-weight: 1000;
}

.table th,
.table td {
  border-bottom: 3px solid #111722;
}

.calendar-event {
  border: 2px solid #111722;
  background: #dff9f5;
  color: #111722;
  font-weight: 900;
}

.calendar-event.work {
  background: #16c784;
}

.calendar-event.task {
  background: #ff9f1c;
}

.calendar-event.quote {
  background: #dbeafe;
}

.empty {
  border: 3px dashed #111722;
  background: #fffdf1;
  color: #27313f;
  font-weight: 800;
}

.toast {
  border: 3px solid #fff8df;
  background: #111722;
  box-shadow: 0 6px 0 #000;
  font-weight: 900;
}

@media (max-width: 980px) {
  body {
    background:
      radial-gradient(circle at 10% 0%, rgba(23, 195, 178, 0.24), transparent 28%),
      radial-gradient(circle at 90% 5%, rgba(59, 130, 246, 0.2), transparent 28%),
      #111827;
  }

  .sidebar {
    background: rgba(247, 251, 255, 0.98);
    border-top: 4px solid #111722;
  }

  .nav-help {
    display: none;
  }

  .nav-button[data-mobile-primary="true"] {
    color: #111722;
    background: #fffdf1;
    border: 3px solid #111722;
    border-radius: 14px;
    box-shadow: 0 4px 0 #111722;
  }

  .nav-button.active {
    background: #dff9f5;
  }

  .mobile-page-switcher .tab {
    background: #eaf8ff;
    color: #10202c;
  }

  .mobile-page-switcher .tab.active {
    background: #dff9f5;
    color: #111722;
  }

  .card {
    box-shadow: 0 6px 0 #111722;
  }
}

/* Final readability pass */
.brand-mark {
  border: 3px solid #111722;
  border-radius: 14px;
  background: linear-gradient(180deg, #8be9dc, #17c3b2);
  color: #111722;
  font-weight: 1000;
  box-shadow: 0 5px 0 #111722;
}

.brand h1,
.brand p,
.top-actions .btn,
.card,
.row,
.case-card-button,
.calendar-day,
.mobile-page-switcher .tab,
.field label,
.table,
.table td,
.table th {
  color: #17202a;
}

.sidebar .nav-button {
  color: #f8fbff;
}

.sidebar .nav-button.active,
.sidebar .nav-button:hover {
  color: #111722;
}

@media (max-width: 980px) {
  .sidebar .nav-button {
    color: #111722;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 36px);
  background: rgba(255, 253, 248, 0.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.device-label {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e4edf0;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.mobile-only {
  display: none;
}

.mobile-page-switcher {
  display: none;
}

.ui-mobile-only {
  display: none;
}

.ui-pc-only {
  display: block;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-primary {
  display: none;
  justify-self: end;
}

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 69px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  background: #eee7db;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.nav-icon {
  width: 22px;
  text-align: center;
}

.content {
  padding: clamp(18px, 3vw, 34px);
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  border: 4px solid #111722;
  border-radius: 14px;
  background: #f7fbff;
  color: #17202a;
  box-shadow: 0 7px 0 #111827;
}

.screen-title h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.1;
  color: #17202a;
  text-shadow: none;
}

.screen-title p {
  margin: 8px 0 0;
  color: #334155;
}

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

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

.two-col {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: start;
}

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

.card.pad {
  padding: 18px;
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1;
}

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

.section-title h3 {
  margin: 0;
  font-size: 17px;
}

.list {
  display: grid;
  gap: 10px;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.status-column {
  min-width: 180px;
}

.case-card-button {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.case-card-button:hover {
  background: #f7f2ea;
}

.case-card-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-action-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.case-input-panel {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 3px solid #111722;
  border-radius: 14px;
  background: #eaf8ff;
  box-shadow: 0 5px 0 #111722;
}

.case-input-card {
  border: 3px solid #111722;
  border-radius: 12px;
  background: #fffdf1;
  overflow: hidden;
}

.case-input-card summary {
  padding: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 1000;
}

.case-input-card summary::-webkit-details-marker {
  display: none;
}

.case-input-card summary::after {
  content: "▼";
  float: right;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #111722;
  border-radius: 999px;
  background: #dff9f5;
}

.case-input-card[open] summary::after {
  transform: rotate(180deg);
}

.case-input-card form {
  padding: 0 12px 12px;
}

.case-edit-card {
  margin: 12px 0 14px;
  background: #f7fbff;
}

.case-edit-card summary {
  background: #dff9f5;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row h4 {
  margin: 0 0 5px;
  font-size: 15px;
}

.row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.task-done {
  background: #f1f5f9;
}

.task-done h4,
.task-done p {
  color: #64748b;
}

.task-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

.task-state {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #111722;
  border-radius: 7px;
  background: #fff4c7;
  color: #111722;
  font-size: 13px;
  font-weight: 1000;
}

.task-state.done {
  background: #ddfbea;
}

.task-title {
  flex: 1 1 auto;
  min-width: 0;
  color: #17202a;
  font-weight: 900;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.task-case {
  flex: 0 1 34%;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row,
.schedule-todo-row {
  min-height: 0;
  padding: 8px 10px;
}

.todo-list {
  gap: 7px;
}

.task-row,
.schedule-todo-row,
.work-row,
.receipt-click-row {
  cursor: pointer;
}

.readonly-detail {
  display: grid;
  gap: 8px;
}

.readonly-detail > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 2px solid #111722;
  border-radius: 9px;
  background: #fffdf1;
}

.readonly-detail strong {
  color: #64748b;
  font-size: 13px;
}

.readonly-photo img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 3px solid #111722;
  border-radius: 10px;
  background: #fff;
}

.receipt-photo-form {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 2px solid #111722;
  border-radius: 9px;
  background: #eaf8ff;
}

.task-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 32, 0.65);
}

.task-modal-card {
  width: min(560px, 100%);
  max-height: min(720px, 88dvh);
  overflow: auto;
  padding: 16px;
  border: 4px solid #111722;
  border-radius: 14px;
  background: #f7fbff;
  box-shadow: 0 8px 0 #111722;
}

.task-detail-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 2px solid #111722;
  border-radius: 10px;
  background: #fffdf1;
}

.task-detail-summary strong {
  display: block;
  color: #17202a;
  font-size: 16px;
  line-height: 1.3;
}

.task-detail-summary p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eee7db;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.pill.ok {
  background: #dceee3;
  color: #1c623b;
}

.pill.warn {
  background: #f3e1cf;
  color: #855016;
}

.pill.danger {
  background: #f5d9d5;
  color: #8c2f28;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.btn:hover {
  background: var(--brand-dark);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.btn.secondary:hover {
  background: #f7f2ea;
}

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

.btn.icon {
  width: 38px;
  padding: 0;
}

.plus-button,
.edit-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid #111722;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 #111722;
}

.plus-button:hover,
.edit-button:hover {
  background: var(--brand-dark);
}

.edit-button {
  background: #fffdf1;
  color: #111722;
  font-size: 17px;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-add-panel {
  margin: 10px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.edit-panel {
  margin-bottom: 16px;
  scroll-margin-top: 92px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border: 3px solid #111722;
  border-radius: 12px;
  background: #fffdf1;
  color: #17202a;
  font-weight: 900;
  box-shadow: 0 5px 0 #111722;
}

.check-line input {
  width: 18px;
  height: 18px;
  box-shadow: none;
}

.forms {
  display: grid;
  gap: 12px;
}

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

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

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

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 14px;
}

.tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

.mini-kpi {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-kpi span {
  color: var(--muted);
  font-size: 12px;
}

.mini-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.calendar-day {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-event {
  display: block;
  padding: 7px 8px;
  border-radius: 8px;
  background: #eee7db;
  font-size: 12px;
  line-height: 1.35;
}

.calendar-event.work {
  background: #dceee3;
}

.calendar-event.task {
  background: #f3e1cf;
}

.calendar-event.quote {
  background: #e4edf0;
}

.month-calendar {
  display: grid;
  gap: 10px;
}

.month-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
}

.month-calendar-header strong {
  font-size: clamp(20px, 3vw, 28px);
}

.month-weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-weekdays span {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.month-day {
  min-height: 118px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.month-day.today {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

.month-day.empty-day {
  background: #f1ece4;
}

.month-day-number {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  font-weight: 900;
}

.month-day-number strong {
  font-size: 18px;
  line-height: 1;
}

.month-day-number span {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.month-events {
  display: grid;
  gap: 4px;
}

.month-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 5px;
  border-radius: 6px;
  background: #eee7db;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.month-event.work {
  background: #dceee3;
}

.month-event.task {
  background: #f3e1cf;
}

.mobile-calendar {
  display: grid;
  gap: 14px;
}

.mobile-calendar-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  position: sticky;
  top: 76px;
  z-index: 4;
  padding: 8px 10px;
  border: 2px solid #111722;
  border-radius: 10px;
  background: #f7fbff;
  box-shadow: 0 3px 0 #111722;
}

.mobile-calendar-header .btn {
  min-height: 42px;
  padding: 8px 14px;
  border-width: 2px;
  border-radius: 9px;
  box-shadow: 0 3px 0 #111722;
  font-size: 15px;
}

.mobile-calendar-header strong {
  font-size: 22px;
  font-weight: 1000;
  white-space: nowrap;
  text-align: center;
}

.mobile-calendar-list {
  display: grid;
  gap: 8px;
}

.mobile-calendar-day {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 2px solid #111722;
  border-radius: 10px;
  background: #fffdf1;
  box-shadow: 0 2px 0 #111722;
}

.mobile-calendar-day.today {
  background: #dff9f5;
}

.mobile-calendar-date {
  position: sticky;
  left: 0;
  align-self: stretch;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 44px;
  padding: 5px 4px;
  border: 2px solid #111722;
  border-radius: 8px;
  background: #ffffff;
  line-height: 1.2;
  color: #17202a;
  text-align: center;
}

.mobile-calendar-date strong {
  font-size: 16px;
  font-weight: 1000;
  line-height: 1;
}

.mobile-calendar-date span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
}

.mobile-calendar-events {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.mobile-calendar-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 5px 7px;
  border: 2px solid #111722;
  border-radius: 8px;
  background: #eef8ff;
  box-shadow: 0 1px 0 #111722;
}

.mobile-calendar-event.work {
  background: #ddfbea;
}

.mobile-calendar-event.task {
  background: #fff4c7;
}

.mobile-calendar-event.quote {
  background: #e0f7ff;
}

.event-type {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  padding: 3px 6px;
  border: 2px solid #111722;
  border-radius: 999px;
  background: #ffffff;
  color: #17202a;
  font-size: 11px;
  font-weight: 1000;
  line-height: 1;
}

.event-title {
  min-width: 0;
  color: #17202a;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.calendar-empty-slot {
  display: block;
  min-height: 34px;
  padding: 7px 9px;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  color: #64748b;
  background: #f8fafc;
  font-weight: 800;
  font-size: 14px;
}

.month-event.quote {
  background: #e4edf0;
}

.schedule-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.schedule-todo-form {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.schedule-todo-row h4 {
  margin-bottom: 4px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.receipt-preview {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.receipt-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.receipt-list {
  display: grid;
  gap: 10px;
}

.receipt-section {
  margin-top: 18px;
  border: 3px solid #111722;
  border-radius: 14px;
  background: #eaf8ff;
  box-shadow: 0 5px 0 #111722;
  overflow: hidden;
}

.receipt-section[open] > .receipt-section-summary .receipt-toggle {
  transform: rotate(180deg);
}

.receipt-section-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.receipt-section-summary::-webkit-details-marker {
  display: none;
}

.receipt-section-summary strong {
  font-size: 17px;
  font-weight: 1000;
}

.receipt-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.receipt-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-section-summary .section-actions {
  justify-self: end;
}

.receipt-section-total {
  font-weight: 1000;
}

.receipt-section-body {
  padding: 0 12px 12px;
}

.receipt-item {
  display: block;
  width: 100%;
  border: 3px solid #111722;
  border-radius: 12px;
  background: #fffdf1;
  color: #17202a;
  box-shadow: 0 5px 0 #111722;
  overflow: hidden;
  text-align: left;
}

.receipt-item:hover {
  background: #fff7c7;
}

.receipt-summary {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 112px 92px 88px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.receipt-summary::-webkit-details-marker {
  display: none;
}

.receipt-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #111722;
  border-radius: 999px;
  background: #dff9f5;
  color: #111722;
  font-size: 12px;
  transition: transform 150ms ease;
}

.receipt-date,
.receipt-category,
.receipt-amount {
  font-weight: 1000;
}

.receipt-date,
.receipt-summary .pill {
  justify-self: end;
}

.receipt-content {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.photo-dot {
  min-height: 32px;
  padding: 4px 8px;
  border: 3px solid #111722;
  border-radius: 999px;
  background: #e5e7eb;
  color: #64748b;
  font-weight: 1000;
  box-shadow: 0 3px 0 #111722;
}

.photo-dot.has-photo {
  background: #facc15;
  color: #111722;
}

.photo-dot:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.receipt-detail {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px 50px;
}

.receipt-detail > div:not(.receipt-photo-inline):not(.receipt-detail-actions):not(.empty) {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
}

.receipt-detail-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.receipt-detail strong {
  color: #475569;
}

.receipt-photo-inline img {
  max-width: min(420px, 100%);
  max-height: 320px;
  object-fit: contain;
  border: 3px solid #111722;
  border-radius: 12px;
  background: #fff;
}

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

.receipt-modal-card {
  width: min(860px, 100%);
  max-height: 92dvh;
  overflow: auto;
  padding: 16px;
  border: 4px solid #111722;
  border-radius: 14px;
  background: #f7fbff;
  box-shadow: 0 8px 0 #111722;
}

.receipt-modal-card img {
  display: block;
  width: 100%;
  max-height: 74dvh;
  object-fit: contain;
  border: 3px solid #111722;
  border-radius: 12px;
  background: #fff;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.login-card {
  width: min(440px, 100%);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #20211e;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 50;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  body {
    background: #fbf8f1;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }

  .top-actions {
    display: none;
  }

  .logout-primary {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 9px;
    border-width: 2px;
    border-radius: 9px;
    box-shadow: 0 3px 0 #111722;
    font-size: 13px;
    white-space: nowrap;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: calc(100dvh - 58px);
    padding-bottom: 82px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 20;
    display: flex;
    justify-content: space-around;
    gap: 4px;
    overflow-x: hidden;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 24px rgba(52, 49, 42, 0.1);
  }

  .nav-button {
    display: none;
    width: 25%;
    min-width: 0;
    justify-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    margin-bottom: 0;
    white-space: normal;
    font-size: 11px;
  }

  .nav-button[data-mobile-primary="true"] {
    display: grid;
  }

  .nav-icon {
    width: auto;
    font-size: 16px;
  }

  .content {
    padding: 12px;
  }

  .screen-header {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
  }

  .screen-title h2 {
    font-size: 24px;
  }

  .screen-title p {
    font-size: 13px;
  }

  .metrics,
  .two-col,
  .detail-kpis,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .status-board {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .status-column {
    min-width: 0;
  }

  .card {
    box-shadow: none;
  }

  .card.pad {
    padding: 14px;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .row-actions .btn,
  .screen-header .btn,
  form .btn {
    width: 100%;
  }

  .case-card-button {
    min-height: 96px;
  }

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

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

  .case-action-bar .btn {
    width: 100%;
    min-height: 48px;
  }

  .case-list-panel {
    max-height: 280px;
    overflow: auto;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .month-weekdays,
  .month-grid {
    min-width: 760px;
  }

  .month-calendar {
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .table,
  .table thead,
  .table tbody,
  .table tr,
  .table th,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tr {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .table th,
  .table td {
    padding: 4px 0;
    border-bottom: 0;
    white-space: normal;
  }

  .table tbody tr th:first-child,
  .table tbody tr td:first-child {
    font-weight: 700;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 46px;
    font-size: 16px;
  }

  .toast {
    right: 12px;
    bottom: 88px;
    left: 12px;
    max-width: none;
  }

  .receipt-summary {
    grid-template-columns: minmax(0, 1fr) 72px 82px;
    gap: 8px;
  }

  .receipt-section-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .receipt-section-total {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .receipt-section-summary .section-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .receipt-summary .receipt-category {
    grid-column: 1 / -1;
  }

  .receipt-summary .receipt-content {
    grid-column: 1 / -1;
  }

  .receipt-summary .receipt-amount {
    grid-column: 1;
    justify-self: start;
  }

  .receipt-summary .receipt-date {
    grid-column: 2;
    justify-self: end;
  }

  .receipt-summary .pill {
    grid-column: 3;
    justify-self: end;
  }

  .receipt-detail {
    padding: 0 10px 10px 10px;
  }

  .receipt-detail > div:not(.receipt-photo-inline):not(.receipt-detail-actions):not(.empty) {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .mobile-only {
    display: block;
  }

  .ui-mobile-only {
    display: block;
  }

  .ui-pc-only {
    display: none;
  }

  .mobile-page-switcher {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
  }

  .mobile-page-switcher .tab {
    flex: 1 0 auto;
    min-height: 40px;
  }

  .pc-only {
    display: none;
  }

}
