:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #23302b;
  background: #f6f8f5;
  --ink: #23302b;
  --muted: #607067;
  --line: #dfe7e0;
  --accent: #225742;
  --soft: #e7f1e9;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 225px minmax(0, 1fr); }
button, select, input { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid #377d62; outline-offset: 3px; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 17px 18px; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); }
.brand, .sidebar-footer { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand img { display: block; width: 100%; max-width: 175px; height: auto; }
small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.avatar { display: grid; place-content: center; flex: none; }
.sidebar nav { display: grid; gap: 6px; margin-top: 47px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 9px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.sidebar nav a:hover, .sidebar nav a[aria-current] { background: var(--soft); color: var(--accent); }
.sidebar nav a span { font-size: 19px; line-height: 1; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding-top: 17px; font-size: 13px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--soft); color: var(--accent); font-weight: 700; }
.topbar { height: 65px; border-bottom: 1px solid var(--line); background: #fff; display: flex; justify-content: space-between; align-items: center; padding: 0 35px; color: var(--muted); font-size: 13px; }
.topbar strong { color: var(--ink); }
.divider { margin: 0 9px; color: #a1ada3; }
.demo, .pill { display: inline-flex; align-items: center; gap: 7px; background: var(--soft); color: var(--accent); border-radius: 30px; padding: 6px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.demo i { width: 6px; height: 6px; border-radius: 50%; background: #57966b; }
main { max-width: 1470px; margin: auto; padding: 31px 35px 45px; }
.page-head, .row, .panel-head, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head { margin-bottom: 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: 34px; letter-spacing: -1.3px; line-height: 1.12; }
h2 { font-size: 17px; letter-spacing: -.25px; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 8px; }
.btn, select, input { border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); min-height: 38px; padding: 8px 12px; }
.btn { font-size: 13px; font-weight: 650; }
.btn:hover { background: #f0f5ef; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover { background: #174230; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; min-width: 0; }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.agenda-layout { display: grid; grid-template-columns: minmax(0,1fr) 245px; gap: 17px; align-items: start; }
.aside { display: grid; gap: 16px; }
.toolbar { padding: 12px 15px; border-bottom: 1px solid var(--line); }
.group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.segment { background: #f2f5f1; border-radius: 8px; padding: 3px; }
.segment .btn { border: 0; background: transparent; padding: 5px 9px; min-height: 29px; }
.segment .active { background: white; color: var(--accent); box-shadow: 0 1px 3px #253b2820; }
.scroll { overflow: auto; }
.schedule { display: grid; grid-template-columns: 57px repeat(var(--columns), minmax(92px,1fr)); min-width: var(--width); }
.schedule > * { min-width: 0; border-bottom: 1px solid #edf1eb; border-right: 1px solid #edf1eb; }
.schedule .label { color: var(--muted); padding: 11px 8px; text-align: center; font-size: 12px; font-weight: 650; background: #fafcf9; }
.hour { padding: 9px 6px; text-align: center; font-size: 11px; color: var(--muted); }
.slot { min-height: 63px; padding: 4px; }
.event { width: 100%; border: 0; border-left: 3px solid #58896d; border-radius: 6px; padding: 7px; margin-bottom: 3px; background: #e9f3eb; color: #254b38; text-align: left; font-size: 12px; overflow-wrap: anywhere; }
.event:hover { filter: brightness(.97); }
.event small { font-size: 11px; color: inherit; }
.event.blocked { background: #f0eeeb; border-color: #898179; color: #57524d; }
.month-grid, .mini-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.month-grid > div { min-height: 78px; padding: 6px; border: 1px solid #eef2ed; }
.month-grid .weekday { min-height: 0; font-size: 12px; text-align: center; color: var(--muted); }
.mini { padding: 12px; }
.mini-grid { gap: 2px; margin-top: 9px; }
.mini-grid span, .mini-grid button { text-align: center; padding: 5px 0; color: var(--muted); font-size: 12px; background: transparent; border: 0; border-radius: 5px; }
.mini-grid .active { background: var(--accent); color: white; }
.mini-grid button:not(.active):hover { background: var(--soft); }
.list { margin: 0; padding: 5px 15px; list-style: none; }
.list li { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list li:last-child { border: 0; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 19px; }
.stat { padding: 17px; color: var(--muted); font-size: 13px; }
.stat strong { display: block; color: var(--ink); font-size: 25px; margin-top: 6px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid #edf1ec; }
th { color: var(--muted); background: #fafcf9; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
.pill.warn { background: #fff2da; color: #795519; }
.stack { display: grid; gap: 17px; }
.empty { color: var(--muted); padding: 16px; font-size: 13px; }
dialog { max-width: min(560px, calc(100% - 24px)); width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: 0 15px 60px #21382933; }
dialog::backdrop { background: #182b2380; }
.form { padding: 18px; display: grid; gap: 13px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
input, select { width: 100%; min-width: 0; }
.group select, .toolbar input { width: auto; max-width: 100%; }
.form-error { color: #9b302c; font-size: 13px; }
#notice:not(:empty) { position: fixed; right: 17px; bottom: 17px; background: var(--accent); color: #fff; border-radius: 9px; padding: 12px 15px; z-index: 2; }
.receipt { padding: 20px; }
.receipt p { margin: 8px 0; }
@media (max-width: 1040px) { .agenda-layout { grid-template-columns: minmax(0,1fr); } .aside { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 720px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 11px; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 5px; }
  .sidebar nav { display: flex; flex-wrap: wrap; margin-top: 10px; }
  .sidebar-footer, .topbar { display: none; }
  main { padding: 21px 12px; }
  h1 { font-size: 28px; }
  .stat { padding: 11px; }
  .stat strong { font-size: 17px; }
  .aside { grid-template-columns: minmax(0,1fr); }
}
@media print {
  body > :not(dialog) { display: none !important; }
  dialog[open] { display: block; position: static; margin: 0; border: 0; box-shadow: none; max-width: 100%; }
  dialog::backdrop { background: transparent; }
  dialog button { display: none; }
}

.form textarea {
  width: 100%;
  min-height: 76px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.client-notes { white-space: pre-wrap; overflow-wrap: anywhere; }

#new-sale-client {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#new-sale-client[hidden] { display: none; }
#new-sale-client legend { padding: 0 4px; font-size: 13px; }

.dashboard {
  --dashboard-green: #13d874;
  display: grid;
  gap: 20px;
}
.dashboard-heading { align-items: start; }
.dashboard-heading .group { align-items: end; gap: 12px; }
.dashboard-heading input, .dashboard-heading select { border-radius: 14px; min-height: 36px; }
.dashboard-shortcuts { gap: 10px; }
.dashboard-shortcuts .btn { padding: 10px 17px; border-radius: 14px; }
.dashboard-shortcuts .primary { background: var(--dashboard-green); color: #10261b; border-color: var(--dashboard-green); }
.dashboard-shortcuts .primary:hover { background: #2fe288; }
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 12px;
}
.dashboard-card {
  background: #fff;
  border: 1px solid #dfe7e4;
  border-radius: 21px;
  box-shadow: 0 2px 4px #203b2e19;
  min-width: 0;
}
.dashboard-metrics .dashboard-card { display: flex; align-items: center; gap: 10px; padding: 15px 13px; }
.dashboard-metrics strong { display: block; font-size: 19px; letter-spacing: -.025em; }
.dashboard-icon {
  flex: 0 0 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e8f9ee;
  color: #157445;
  font-weight: 700;
}
.dashboard-card:nth-child(4n + 1) .dashboard-icon { background: #eeefff; color: #4d44bb; }
.dashboard-card:nth-child(4n + 2) .dashboard-icon { background: #fff5e0; color: #985313; }
.dashboard-section { padding: clamp(16px, 2vw, 24px); }
.dashboard-section h3, .dashboard-close-body h3 { margin: 0 0 6px; font-size: 14px; }
.dashboard-close-body, .dashboard-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
  gap: 16px;
}
.dashboard-close-body { margin-top: 14px; }
.dashboard-totals {
  align-self: start;
  display: grid;
  gap: 10px;
  border-radius: 15px;
  background: #f4f8f6;
  padding: 14px;
}
.dashboard-totals strong, .dashboard-count { font-size: clamp(22px, 3vw, 32px); }
.dashboard-totals small { display: inline; margin-left: 4px; }
.dashboard-cash { padding: 9px 11px; border-radius: 12px; background: #daf6e5; color: #145033; }
.dashboard-count { display: block; margin-top: 5px; }
.dashboard-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.dashboard-chart-day { display: grid; gap: 6px; text-align: center; min-width: 0; }
.dashboard-chart-day > span { font-size: clamp(8px, 1vw, 11px); overflow-wrap: anywhere; }
.dashboard-track { height: 78px; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); }
.dashboard-track i { width: min(55%, 28px); background: #13d874; border-radius: 5px 5px 0 0; }
@media print {
  .dashboard-close-body { display: block; }
  .dashboard-close-body > div + div { margin-top: 16px; }
}

#report-filters .row, .report-dates { align-items: end; }
#report-filters .segment { margin-top: 5px; }
#report-filters .form-error:empty { display: none; }
.report-tabs .btn { border-radius: 20px; }
.report-tabs .active { border-color: #76c49d; background: #e7f7ed; color: #145b37; }
.report-metrics .stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); margin: 0; }

.report-chart { padding: clamp(16px, 2.5vw, 28px); border-radius: 22px; }
.report-chart-total { display: block; font-size: clamp(24px, 3vw, 34px); margin: 12px 0 20px; }
.report-area { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.report-axis { display: flex; flex-direction: column; justify-content: space-between; height: 180px; text-align: right; }
.report-axis, .report-axis-dates { font-size: 11px; color: var(--muted); }
.report-plot { display: block; width: 100%; height: 180px; overflow: visible; }
.report-gridline { stroke: var(--line); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.report-income-line { fill: none; stroke: #12c861; stroke-width: 2; vector-effect: non-scaling-stroke; }
.report-axis-dates { display: flex; justify-content: space-between; gap: 4px; margin-top: 8px; }
.report-payment-chart { display: flex; align-items: center; gap: 24px; margin-top: 18px; }
.report-payment-chart ul { flex: 1; min-width: 0; }
.report-payment-chart li i { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; }
.report-donut { width: clamp(105px, 16vw, 165px); aspect-ratio: 1; flex: none; border-radius: 50%; position: relative; }
.report-donut::after { content: ""; position: absolute; inset: 20%; border-radius: 50%; background: #fff; }
@media (max-width: 540px) {
  .report-payment-chart { align-items: flex-start; flex-direction: column; }
  .report-payment-chart ul { width: 100%; }
  .report-axis-dates span:nth-child(even):not(:last-child) { display: none; }
}

.card-payment-fields {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.card-payment-fields[hidden] { display: none; }
.card-payment-fields legend { padding: 0 4px; font-size: 13px; }

.seller-fields, .seller-row {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.seller-row { margin-top: 8px; }
.seller-fields [hidden] { display: none; }

.thermal-ticket {
  width: min(100%, 72mm);
  margin: 0 auto;
  padding: 12px 10px;
  color: #111;
  background: #fff;
  border: 1px solid var(--line);
  font: 12px/1.4 "Courier New", monospace;
  overflow-wrap: anywhere;
}
.thermal-ticket[data-paper="58"] { width: min(100%, 52mm); }
.ticket-header, .ticket-footer { text-align: center; }
.ticket-header img { display: block; width: 80%; height: auto; margin: 0 auto 8px; }
.thermal-ticket p { margin: 4px 0; }
.ticket-section, .thermal-ticket .ticket-footer { border-top: 1px dashed #444; margin-top: 8px; padding-top: 8px; }
.ticket-footer p + p { margin-top: 9px; }
.ticket-amount { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: 4px; }
.ticket-amount strong { flex: none; white-space: nowrap; }
.ticket-total { margin-top: 8px; font-size: 15px; }
.ticket-controls { margin-top: 16px; align-items: end; }
@media print {
  body:has(dialog[open] .thermal-ticket) { display: block; background: #fff; }
  dialog:has(.thermal-ticket) { inset: auto; width: auto; max-height: none; overflow: visible; }
  dialog:has(.thermal-ticket) .panel-head, dialog .ticket-controls { display: none; }
  dialog:has(.thermal-ticket) .receipt { padding: 0; }
  .thermal-ticket { margin: 0; border: 0; padding: 0; font-size: 9pt; }
  .ticket-header, .ticket-amount { break-inside: avoid; }
}

.settings-nav { margin-bottom: 18px; gap: 8px; }
.settings-nav a { display: inline-flex; align-items: center; text-decoration: none; }
.settings-nav [aria-pressed="true"] { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.settings-panel { max-width: 850px; }
.settings-rows { margin: 0; padding: 4px 18px; }
.settings-rows > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; padding: 14px 0; }
.settings-rows > div + div { border-top: 1px solid var(--line); }
.settings-rows dt { color: var(--muted); }
.settings-rows dd { margin: 0; overflow-wrap: anywhere; }
.settings-note { padding: 18px; color: var(--muted); }
.settings-hours { min-width: 0; display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.form .settings-check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.settings-check input { min-height: auto; }

.sidebar nav a[hidden] { display: none; }
.settings-note .group { margin-top: 10px; }
@media (max-width: 780px) {
  .topbar:has(#role-preview:not(:empty)) { display: flex; height: auto; padding: 8px 12px; }
}

body.auth-screen { display: block; }
.auth-screen .sidebar, .auth-screen .topbar { display: none; }
.auth-card { max-width: 440px; margin: 7vh auto 0; }
.auth-card .panel-head { display: grid; }
.auth-card img { max-width: 190px; height: auto; }
.auth-card h1 { font-size: 25px; }
.auth-card .form-error:empty { display: none; }

.demo[hidden] { display: none; }
