:root {
  --gold: #c8a565;
  --gold-soft: #f5efe2;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --bg: #f7f5f2;
}
body { background: #ebe4d8; color: var(--ink); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin: 0; }
.app-shell {
  width: calc(100% - 20px);
  min-height: calc(100vh - 20px);
  margin: 10px auto;
  background: var(--bg);
  border: 1px solid #ddd6cc;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(28, 25, 23, .06);
}
.topnav { background: var(--ink); padding: 0; border-radius: 11px 11px 0 0; min-height: 58px; }
.topnav .navbar-nav { gap: 2px; }
.topnav .brand { display: flex; gap: 10px; align-items: center; text-decoration: none; margin-right: 18px; }
.topnav .brand img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 6px; }
.topnav .brand strong { color: #fff; display: block; line-height: 1.1; font-size: 15px; }
.topnav .brand small { color: #a8a29e; font-size: 12px; }
.topnav .nav-link { color: #d6d3d1; border-radius: 0; padding: 18px 12px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 0; background: transparent; border: 0; border-bottom: 2px solid transparent; line-height: 1; }
.topnav .nav-link .ico { display: none; }
.topnav .nav-link:hover, .topnav .nav-link:focus { color: #fff; background: transparent; }
.topnav .nav-link.active { background: transparent; color: var(--gold); font-weight: 600; border-bottom-color: var(--gold); }
.topnav .nav-link.active:hover { background: transparent; color: var(--gold); }
.topnav .dropdown-menu { border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-width: 190px; margin-top: 0; box-shadow: 0 10px 24px rgba(28, 25, 23, .12); }
.topnav .dropdown-item { display: flex; align-items: center; gap: 8px; border-radius: 6px; color: var(--ink); font-size: 14px; padding: 8px 10px; }
.topnav .dropdown-item .ico { display: none; }
.topnav .dropdown-item.active { background: var(--gold-soft); color: var(--ink); font-weight: 600; }
.topnav .dropdown-item:hover { background: var(--gold-soft); color: var(--ink); }
.topnav .navbar-toggler { border-color: rgba(255,255,255,.25); }
.topnav .navbar-toggler-icon { filter: invert(1); }
.topnav .nav-side { display: flex; align-items: center; gap: 12px; margin-left: 16px; color: #a8a29e; font-size: 13px; white-space: nowrap; }
.topnav .nav-side a { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 5px 12px; }
.ico { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 22px; display: flex; align-items: center; min-height: 58px; }
.topbar h1 { font-size: 20px; margin: 0; line-height: 1.2; }
.chart-box { position: relative; height: 320px; }
.content { padding: 18px 22px 32px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 12px 16px; position: relative; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: clamp(15px, 1.35vw, 20px); font-weight: 700; }
table.data thead th { background: var(--gold-soft); font-size: 13px; font-weight: 700; border-bottom: 0; }
table.data td, table.data th { vertical-align: middle; white-space: nowrap; }
.field-label { display: block; font-size: 11px; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
a.detail-link { color: var(--ink); font-weight: 600; text-decoration: none; }
a.detail-link:hover { color: #8a6a32; text-decoration: underline; }
.detail-value { font-weight: 600; }
.form-control, .form-select { border-color: var(--line); border-radius: 4px; }
.btn-gold { background: var(--gold); color: var(--ink); border: 1px solid var(--gold); font-weight: 700; }
.btn-gold:hover { background: #b8944e; color: var(--ink); }
.btn-gold:disabled { opacity: .7; }
.btn-line { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-line:hover { background: var(--gold-soft); color: var(--ink); }
.modal-content { border: 1px solid var(--line); border-radius: 10px; }
.modal-header, .modal-footer { border-color: var(--line); }
.field-error { color: #9a3412; font-size: 12px; margin: 2px 0 8px; }
.form-control.is-invalid, .form-select.is-invalid, .pick:has(select.is-invalid) .pick-btn { border-color: #c2410c; }
.pick { position: relative; }
.pick-btn { width: 100%; background-color: #fff; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; border: 0 !important; }
.pick-menu { position: fixed; z-index: 1080; display: flex; flex-direction: column; gap: 6px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(28, 25, 23, .12); }
.pick-menu[hidden] { display: none !important; }
.pick-options { overflow: auto; max-height: 220px; }
.pick-option { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 4px; padding: 6px 8px; font-size: 14px; }
.pick-option:hover, .pick-option.is-active { background: var(--gold-soft); }
.pick-option[hidden] { display: none !important; }
.pick-empty { color: var(--muted); font-size: 13px; padding: 4px 8px; }
.list-filters .pick { min-width: 160px; }
.line-items { display: flex; flex-direction: column; gap: 8px; }
.line-add, .line-remove { white-space: nowrap; }
.entry-form .spin { display: none; margin-right: 6px; }
.entry-form.is-loading .spin { display: inline-block; }
.chart-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-bar h2 { margin: 0; }
.section-bar .share { margin-left: auto; }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list-tools-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 auto; min-width: 0; }
.list-search { width: 220px; max-width: 100%; flex: 0 1 220px; }
.list-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.list-filters select, .list-size { width: auto; min-width: 140px; }
.list-size { margin-left: auto; }
.list-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.list-pager .btn { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.list-pager .btn:disabled { opacity: .45; }
.content > .mb-3:has(> .share) { display: flex; justify-content: flex-end; }
.share { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share a, .share button { border: 1px solid var(--gold); background: #fff; color: var(--ink); border-radius: 999px; padding: 4px 14px; min-width: 96px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; text-decoration: none; }
table.data { width: 100%; }
table.data .col-money { width: 9.5rem; }
table.data th.text-end, table.data td.text-end { width: 9.5rem; font-variant-numeric: tabular-nums; }
.print-sheet, .print-fields { display: none; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.wait { background: #fef3c7; color: #92400e; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; text-align: center; }
.login-card img { width: 72px; height: 72px; object-fit: contain; }
.row > [class*="col"] { min-width: 0; }
.table-responsive { max-width: 100%; -webkit-overflow-scrolling: touch; }
.chart-box { width: 100%; }
.content .d-flex { flex-wrap: wrap; }
@media (max-width: 1199.98px) {
  .topnav .navbar-collapse { padding-bottom: 8px; }
  .topnav .nav-link { width: 100%; text-align: left; padding: 10px 12px; border-bottom: 0; }
  .topnav .nav-link.active { background: rgba(200, 165, 101, .16); border-radius: 6px; }
  .topnav .nav-side { white-space: normal; padding: 8px 12px 2px; margin-left: 0; }
  .topnav .dropdown-menu {
    position: static !important;
    transform: none !important;
    inset: auto !important;
    float: none;
    width: 100%;
    min-width: 0;
    margin: 0;
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    padding: 0 0 4px 18px;
  }
  .topnav .dropdown-item { color: #e7e5e4 !important; background: transparent; }
  .topnav .dropdown-item:hover, .topnav .dropdown-item:focus { background: rgba(255,255,255,.08) !important; color: #fff !important; }
  .topnav .dropdown-item.active, .topnav .dropdown-item.active:hover { background: var(--gold) !important; color: var(--ink) !important; }
}
@media (max-width: 767.98px) {
  .app-shell { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .topnav { border-radius: 0; }
  .content { padding: 14px 12px 28px; }
  .topbar, .panel { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-top: 12px; padding-bottom: 12px; }
  .chart-box { height: 220px; }
  .content .form-select { max-width: 100% !important; width: 100%; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { width: auto; height: auto; background: #fff !important; }
  .print-sheet {
    display: flex !important;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #c8a565;
    padding-bottom: 8px;
    margin: 0 0 12px;
  }
  .print-sheet img { width: 42px; height: 42px; object-fit: contain; }
  .print-brand { display: flex; flex-direction: column; }
  .print-brand strong { font-size: 16px; line-height: 1.2; }
  .print-brand span { font-size: 11px; color: #444; }
  .print-meta { margin-left: auto; text-align: right; font-size: 11px; color: #444; display: flex; flex-direction: column; }
  .topnav, .share, .no-print, .list-tools, .list-pager, .modal, form, .detail-grid { display: none !important; }
  .print-fields { display: table !important; width: 100%; border-collapse: collapse; margin: 0; }
  .print-fields td { width: 33.33%; border: 1px solid #d6d3d1; padding: 6px 8px; vertical-align: top; }
  [data-list] tbody tr[hidden] { display: table-row !important; }
  [data-list] tbody tr.list-empty { display: none !important; }
  .app-shell, .panel, .topbar, .content, .kpi { background: #fff !important; box-shadow: none !important; }
  .app-shell { width: 100% !important; max-width: none !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; }
  .topbar { border: 0; padding: 0 0 8px; min-height: 0; }
  .topbar h1 { font-size: 15px; }
  .content { padding: 0 !important; }
  .panel { border: 0 !important; border-radius: 0; padding: 0 0 12px !important; margin: 0 0 8px; }
  .section-bar { margin: 0 0 4px; }
  .kpi { border: 1px solid #d6d3d1 !important; break-inside: avoid; }
  .chart-box { break-inside: avoid; height: 180px; }
  .table-responsive { overflow: visible !important; }
  table.data { width: 100% !important; table-layout: fixed; border-collapse: collapse; }
  table.data col.col-money { width: 16%; }
  table.data th, table.data td { border: 1px solid #d6d3d1 !important; white-space: normal !important; width: auto; overflow: visible; text-overflow: clip; padding: 5px 8px; }
  table.data thead { display: table-header-group; }
  table.data thead th { background: #f5efe2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data tr[data-pin="1"] td { font-weight: 700; }
  .pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a, a.detail-link { color: #1c1917 !important; text-decoration: none !important; font-weight: 500; }
}
