:root {
  --primary: #7167f9;
  --primary-dark: #5850d8;
  --primary-soft: #eeecff;
  --accent: #19b7a0;
  --ink: #24263a;
  --muted: #73778e;
  --line: #e7e8f0;
  --bg: #f6f7fb;
  --card: #fff;
  --danger: #c4455e;
  --warning: #a56600;
  --success: #167a60;
  --shadow: 0 10px 35px rgba(29, 33, 68, .07);
  --radius: 18px;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: var(--primary-dark); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 750; color: var(--ink); padding: 0 8px 22px; min-width: 0; }
.brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand b { color: var(--primary); font-weight: 800; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: inline-grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, var(--primary), #9d7df9); color: #fff; font-size: 20px; font-weight: 800; box-shadow: 0 8px 18px #7167f936; }
.nav { display: grid; gap: 5px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 11px; color: #595d72; font-weight: 600; }
.nav a span { width: 22px; text-align: center; font-size: 18px; }
.nav a:hover { background: #f6f5ff; color: var(--primary-dark); }
.nav a.active { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-foot { margin-top: auto; padding: 15px 10px 4px; border-top: 1px solid var(--line); display: grid; gap: 3px; }
.sidebar-foot small { color: var(--muted); }
.sidebar-foot strong { font-size: 12px; word-break: break-word; }
.main { min-width: 0; }
.topbar { min-height: 86px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 20; }
.topbar-title { min-width: 0; }
.topbar h1 { font-size: 22px; margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 10px; color: var(--muted); font-weight: 700; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.avatar, .mini-avatar { display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; border-radius: 50%; }
.avatar { width: 38px; height: 38px; }
.user-copy { display: grid; }
.user-copy strong { font-size: 13px; }
.user-copy small { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.link-button { border: 0; background: none; color: var(--muted); padding: 8px; }
.link-button:hover { color: var(--danger); }
.content { padding: 28px; max-width: 1540px; margin: 0 auto; }
.mobile-only { display: none; }

.alert { padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success, .toast-success { background: #eafaf4; color: var(--success); border-color: #c9eee1; }
.alert-danger, .toast-danger { background: #fff0f3; color: var(--danger); border-color: #ffd4dd; }
.alert-warning, .toast-warning { background: #fff8e6; color: var(--warning); border-color: #f7e4aa; }
.toast { position: fixed; right: 20px; top: 20px; z-index: 100; padding: 13px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 360px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 5px 20px rgba(29, 33, 68, .035); display: grid; gap: 7px; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { font-size: 30px; line-height: 1; }
.metric-card small { color: var(--muted); }
.metric-card.accent { background: linear-gradient(145deg, #7167f9, #8a6df7); color: #fff; border: 0; }
.metric-card.accent span, .metric-card.accent small { color: #ffffffcc; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 25px rgba(29, 33, 68, .045); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 21px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0 0 4px; font-size: 18px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #fff; color: var(--ink); border-color: #dfe0e9; }
.button-secondary:hover { background: #f8f8fc; }
.button-light { background: #f5f5fa; color: #55596e; }
.button-small { padding: 7px 10px; font-size: 12px; }
.button-block { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.icon-button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; width: 40px; height: 40px; display: inline-grid; place-items: center; font-size: 22px; line-height: 1; }
.icon-button:hover { background: #f6f5ff; color: var(--primary-dark); }
.filter-bar { display: flex; gap: 10px; padding: 16px 22px; background: #fbfbfd; border-bottom: 1px solid var(--line); }
.filter-bar input { max-width: 420px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fbfbfd; }
tbody tr:hover { background: #fcfcff; }
.table-sub { display: block; color: var(--muted); margin-top: 3px; }
.align-right { text-align: right; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.status-active { background: #e8f9f3; color: var(--success); }
.status-suspended { background: #fff0f3; color: var(--danger); }
.empty-state { text-align: center; padding: 56px 20px; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 25px; }
.empty-state h3 { margin: 0 0 5px; }
.empty-state p { margin: 0; color: var(--muted); }
.inline-empty { padding: 18px; border: 1px dashed #d8d9e5; border-radius: 12px; color: var(--muted); background: #fbfbfd; }

.form-panel { max-width: 980px; }
.professional-form-panel, .appointment-form-panel { max-width: 1100px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 22px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.full, .full { grid-column: 1 / -1; }
.field label { font-weight: 650; font-size: 13px; }
.field small { color: var(--muted); font-size: 11px; }
.form-grid input, .form-grid select, .form-grid textarea, .filter-bar input, .agenda-professional-filter select, .agenda-date-form input { width: 100%; border: 1px solid #dcdde7; border-radius: 10px; padding: 11px 12px; background: #fff; color: var(--ink); outline: none; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .filter-bar input:focus, .agenda-professional-filter select:focus, .agenda-date-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px #7167f917; }
.form-grid textarea { resize: vertical; }
.input-prefix { display: flex; border: 1px solid #dcdde7; border-radius: 10px; overflow: hidden; background: #fff; }
.input-prefix:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px #7167f917; }
.input-prefix span { padding: 11px 12px; background: #f5f5f9; color: var(--muted); border-right: 1px solid var(--line); }
.input-prefix input { border: 0; border-radius: 0; box-shadow: none !important; }
.form-separator { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 7px; padding-top: 20px; font-weight: 750; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 4px; }
.color-field { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.color-field input[type="color"] { width: 58px; min-width: 58px; height: 44px; padding: 4px; }
.color-field span { color: var(--muted); font-size: 12px; }
.switch-field { display: flex; align-items: center; gap: 11px; cursor: pointer; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.switch-field > input, .schedule-day > input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control { width: 38px; height: 22px; flex: 0 0 38px; border-radius: 999px; background: #d8d9e2; position: relative; transition: .18s ease; }
.switch-control::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px #0002; transition: .18s ease; }
.switch-field input:checked + .switch-control, .schedule-day input:checked + .switch-control { background: var(--primary); }
.switch-field input:checked + .switch-control::after, .schedule-day input:checked + .switch-control::after { transform: translateX(16px); }
.switch-field > span:last-child { display: grid; }
.switch-field small { color: var(--muted); font-size: 11px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; min-width: 0; }
.check-card:hover { border-color: #c9c5ff; background: #fbfaff; }
.check-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { width: 25px; height: 25px; flex: 0 0 25px; border: 1px solid #d8d9e5; border-radius: 8px; color: transparent; display: grid; place-items: center; font-weight: 800; }
.check-card input:checked + .check-box { background: var(--primary); border-color: var(--primary); color: #fff; }
.check-card > span:last-child { display: grid; min-width: 0; }
.check-card strong, .check-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-card small { color: var(--muted); font-size: 11px; }
.schedule-editor { display: grid; gap: 9px; }
.schedule-row { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafafd; opacity: .68; }
.schedule-row.enabled { background: #fff; opacity: 1; }
.schedule-day { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.schedule-times { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 9px; }
.schedule-times label { display: grid; gap: 4px; }
.schedule-times label span { color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; }
.schedule-row:not(.enabled) .schedule-times { pointer-events: none; opacity: .45; }
.appointment-rule-note { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 12px; background: #f3f2ff; color: var(--primary-dark); }
.appointment-rule-note span { color: #626178; font-size: 12px; }

.welcome-card { background: linear-gradient(135deg, #fff, #f1efff); border: 1px solid #dedaff; border-radius: 22px; padding: 26px 28px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; overflow: hidden; }
.welcome-card h2 { font-size: 28px; margin: 10px 0 5px; }
.welcome-card p { margin: 0; color: var(--muted); }
.pill { display: inline-block; padding: 6px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 750; }
.welcome-orb { width: 100px; height: 100px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, var(--primary), #a17df9); color: #fff; font-size: 40px; box-shadow: 0 20px 50px #7167f940; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.quick-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 17px; display: flex; align-items: center; gap: 13px; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; }
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-card b { margin-left: auto; font-size: 22px; color: var(--muted); }
.quick-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 20px; }
.quick-card div { display: grid; }
.quick-card small { color: var(--muted); }

.person-cell { display: flex; align-items: center; gap: 10px; }
.mini-avatar { width: 30px; height: 30px; }
.truncate { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-list { padding: 8px 18px; }
.service-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.service-row:last-child { border-bottom: 0; }
.service-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.service-main, .service-meta { display: grid; gap: 2px; }
.service-main small, .service-meta span { color: var(--muted); font-size: 11px; }
.service-meta { text-align: right; }

.professional-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.professional-card { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: #fff; }
.professional-color { height: 4px; background: var(--professional-color); }
.professional-card-head { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 16px; }
.professional-card-head > div { min-width: 0; display: grid; }
.professional-card-head strong, .professional-card-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.professional-card-head small { color: var(--muted); font-size: 11px; }
.professional-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--professional-color) 14%, white); color: var(--professional-color); font-weight: 800; }
.professional-avatar.compact { width: 34px; height: 34px; border-radius: 11px; flex: 0 0 34px; }
.professional-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 12px 16px; color: var(--muted); font-size: 12px; }
.professional-card-meta b { color: var(--ink); }

.agenda-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.agenda-navigation, .agenda-actions { display: flex; align-items: center; gap: 8px; }
.agenda-date-form { width: 152px; }
.agenda-date-form input { height: 40px; padding: 8px 10px; }
.agenda-date-copy { display: grid; margin-left: 5px; }
.agenda-date-copy strong { font-size: 14px; }
.agenda-date-copy span { color: var(--muted); font-size: 11px; }
.agenda-filter-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; }
.agenda-professional-filter { display: flex; align-items: center; gap: 9px; }
.agenda-professional-filter label { color: var(--muted); font-size: 12px; font-weight: 650; }
.agenda-professional-filter select { min-width: 220px; padding: 8px 10px; }
.agenda-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.agenda-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: #d7d8e2; }
.legend-dot.scheduled { background: #7167f9; }
.legend-dot.confirmed { background: #2694c6; }
.legend-dot.completed { background: #1b9875; }
.legend-dot.blocked { background: #9a9dac; }
.agenda-desktop { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 6px 25px rgba(29, 33, 68, .04); }
.agenda-scroll { overflow: auto; max-height: calc(100vh - 245px); min-height: 480px; }
.agenda-grid { display: grid; grid-template-columns: 72px repeat(var(--agenda-columns), minmax(220px, 1fr)); grid-template-rows: 58px var(--agenda-height); min-width: max(100%, var(--agenda-min-width)); background: #fff; }
.agenda-corner { position: sticky; top: 0; left: 0; z-index: 13; background: #f8f8fb; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.agenda-professional-head { position: sticky; top: 0; z-index: 11; display: flex; align-items: center; gap: 9px; padding: 10px 13px; background: #f8f8fb; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.agenda-professional-head > div { min-width: 0; display: grid; }
.agenda-professional-head strong, .agenda-professional-head small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agenda-professional-head small { color: var(--muted); font-size: 10px; }
.agenda-time-rail { position: sticky; left: 0; z-index: 9; background: #fbfbfd; border-right: 1px solid var(--line); }
.agenda-time-rail span { position: absolute; left: 0; width: 100%; transform: translateY(-8px); padding-right: 9px; text-align: right; color: var(--muted); font-size: 10px; }
.agenda-column { position: relative; overflow: hidden; border-right: 1px solid var(--line); background: #fff; }
.agenda-line { position: absolute; left: 0; right: 0; height: 1px; background: #f0f0f5; z-index: 1; pointer-events: none; }
.agenda-line.hour { background: #dedfe8; }
.agenda-unavailable, .agenda-break { position: absolute; left: 0; right: 0; z-index: 2; background: repeating-linear-gradient(135deg, #f4f4f7, #f4f4f7 7px, #f8f8fa 7px, #f8f8fa 14px); color: #9a9dab; display: grid; place-items: center; font-size: 10px; pointer-events: none; }
.agenda-break { background: #f0f0f4; border-top: 1px dashed #d4d5de; border-bottom: 1px dashed #d4d5de; }
.agenda-event { position: absolute; left: 5px; right: 5px; z-index: 5; border-radius: 8px; padding: 6px 7px; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; box-shadow: 0 2px 7px rgba(28, 31, 59, .09); }
.agenda-event strong, .agenda-event span, .agenda-event small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-event strong { font-size: 11px; }
.agenda-event span { font-size: 10px; opacity: .94; margin-top: 2px; }
.agenda-event small { font-size: 9px; opacity: .8; margin-top: 3px; }
.agenda-appointment { background: var(--event-color); color: #fff; border-left: 3px solid rgba(0, 0, 0, .13); }
.agenda-appointment:hover { filter: brightness(.96); }
.agenda-appointment.status-confirmed { outline: 2px solid #2694c655; }
.agenda-appointment.status-arrived, .agenda-appointment.status-in_service { outline: 2px solid #f4a62a88; }
.agenda-appointment.status-completed { filter: saturate(.55); opacity: .78; }
.agenda-appointment.status-cancelled, .agenda-appointment.status-no_show { background: #a8aab5; text-decoration: line-through; opacity: .72; }
.agenda-block { background: #d9dae1; color: #555866; border-left: 3px solid #9699a8; box-shadow: none; }
.agenda-mobile { display: none; }
.mobile-agenda-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.mobile-agenda-card > header { display: flex; align-items: center; gap: 10px; padding: 13px; background: #fafafd; border-bottom: 1px solid var(--line); }
.mobile-agenda-card > header > div { min-width: 0; display: grid; flex: 1; }
.mobile-agenda-card > header small { color: var(--muted); font-size: 10px; }
.mobile-agenda-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 12px; }
.mobile-agenda-list { display: grid; }
.mobile-agenda-item { display: grid; grid-template-columns: 54px 1fr 4px; gap: 10px; align-items: center; padding: 12px 13px; border-bottom: 1px solid var(--line); color: var(--ink); }
.mobile-agenda-item:last-child { border-bottom: 0; }
.mobile-agenda-item time { display: grid; font-weight: 750; font-size: 13px; }
.mobile-agenda-item time small { color: var(--muted); font-size: 9px; font-weight: 500; }
.mobile-agenda-item > div { min-width: 0; display: grid; }
.mobile-agenda-item strong, .mobile-agenda-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-agenda-item span { color: var(--muted); font-size: 11px; }
.mobile-agenda-item > i { height: 35px; border-radius: 3px; background: var(--event-color); }
.mobile-agenda-item.blocked { grid-template-columns: 54px 1fr; background: #fafafd; }

.client-autocomplete { position: relative; }
.autocomplete-results { position: absolute; top: 71px; left: 0; right: 0; z-index: 40; max-height: 280px; overflow: auto; background: #fff; border: 1px solid #dcdde7; border-radius: 12px; box-shadow: 0 15px 45px rgba(29, 33, 68, .16); padding: 5px; }
.autocomplete-item { width: 100%; border: 0; background: #fff; border-radius: 9px; padding: 10px; text-align: left; display: grid; gap: 2px; color: var(--ink); }
.autocomplete-item:hover, .autocomplete-item:focus { background: var(--primary-soft); outline: none; }
.autocomplete-item small { color: var(--muted); }
.autocomplete-message { padding: 12px; color: var(--muted); font-size: 12px; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth-visual { padding: 46px; display: flex; flex-direction: column; background: radial-gradient(circle at 80% 20%, #9f87ff 0, transparent 32%), linear-gradient(145deg, #4f48c8, #7167f9 52%, #3b9fa3); color: #fff; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.auth-visual .brand-mark { background: #fff; color: var(--primary); }
.auth-message { max-width: 600px; margin: auto 0; }
.auth-message .pill { background: #ffffff20; color: #fff; }
.auth-message h1 { font-size: 50px; line-height: 1.08; margin: 20px 0; }
.auth-message p { font-size: 17px; color: #ffffffd6; max-width: 520px; }
.auth-foot { font-size: 12px; color: #ffffffb8; }
.auth-form-wrap { display: grid; place-items: center; padding: 30px; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 27px; margin: 0 0 3px; }
.auth-card > p { margin: 0 0 25px; }
.auth-card label { display: grid; gap: 7px; font-weight: 650; font-size: 13px; margin-bottom: 16px; }
.auth-card input { padding: 12px; border: 1px solid #dcdde7; border-radius: 10px; outline: none; }
.auth-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px #7167f917; }
.form-help { display: block; color: var(--muted); text-align: center; margin-top: 14px; }
.mobile-brand { display: none; }
.guest-body { background: #fff; }

.public-body { background: linear-gradient(145deg, #fbfbff, #f2f0ff); }
.public-page { min-height: 100vh; max-width: 1200px; margin: auto; padding: 24px; }
.public-header { display: flex; align-items: center; justify-content: space-between; }
.public-hero { min-height: 75vh; display: grid; grid-template-columns: 1.2fr .8fr; gap: 50px; align-items: center; }
.public-hero h1 { font-size: 58px; line-height: 1.04; margin: 18px 0; }
.public-hero p { font-size: 17px; color: var(--muted); max-width: 600px; margin-bottom: 24px; }
.hero-card { background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 45px; box-shadow: 0 25px 70px #564dcc20; display: grid; gap: 8px; text-align: center; }
.hero-symbol { width: 100px; height: 100px; border-radius: 30px; background: linear-gradient(145deg, var(--primary), #a07df9); color: #fff; display: grid; place-items: center; font-size: 44px; margin: 0 auto 12px; }
.hero-card strong { font-size: 23px; }
.hero-card span { color: var(--muted); }
.error-page { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 30px; }
.error-code { font-size: 80px; font-weight: 800; color: var(--primary); }
.error-page h1 { margin: 0; }
.error-page p { color: var(--muted); margin-bottom: 22px; }
.overlay { display: none; }

@media (max-width: 1180px) {
  .professional-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-row { grid-template-columns: 150px 1fr; }
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: 1fr; }
  .auth-message h1 { font-size: 42px; }
  .public-hero h1 { font-size: 48px; }
}

@media (max-width: 900px) {
  .agenda-desktop { display: none; }
  .agenda-mobile { display: grid; gap: 12px; }
  .agenda-toolbar { align-items: flex-start; flex-direction: column; }
  .agenda-actions { width: 100%; }
  .agenda-actions .button { flex: 1; }
  .agenda-filter-panel { align-items: flex-start; flex-direction: column; }
  .agenda-professional-filter, .agenda-professional-filter select { width: 100%; }
}

@media (max-width: 820px) {
  :root { --sidebar: 260px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -280px; transition: left .2s ease; box-shadow: 20px 0 60px #0002; }
  .sidebar.open { left: 0; }
  .overlay { position: fixed; inset: 0; background: #1115; z-index: 25; }
  .overlay.show { display: block; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px; min-height: 76px; }
  .topbar-title { margin-right: auto; margin-left: 10px; }
  .user-copy { display: none; }
  .content { padding: 18px; }
  .panel-head { align-items: flex-start; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-wrap { min-height: 100vh; }
  .mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-weight: 800; font-size: 18px; }
  .public-hero { grid-template-columns: 1fr; }
  .hero-card { display: none; }
  .public-hero h1 { font-size: 42px; }
  .service-row { grid-template-columns: auto 1fr auto; }
  .service-row > .status { grid-column: 2 / 4; justify-self: start; }
  .schedule-row { grid-template-columns: 1fr; }
  .schedule-times { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .professional-grid { grid-template-columns: 1fr; padding: 13px; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .appointment-rule-note { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (max-width: 590px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { padding: 16px; }
  .metric-card strong { font-size: 25px; }
  .panel-head { padding: 17px; flex-direction: column; }
  .panel-head .button { width: 100%; }
  .filter-bar { padding: 13px; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; padding: 17px; }
  .field.full, .form-separator, .form-actions, .full { grid-column: auto; }
  .form-actions .button { width: 100%; }
  .welcome-card { padding: 21px; }
  .welcome-orb { display: none; }
  .welcome-card h2 { font-size: 24px; }
  .user-menu .avatar { display: none; }
  .content { padding: 12px; }
  .topbar h1 { font-size: 18px; }
  .auth-form-wrap { padding: 16px; }
  .auth-card { padding: 24px; border: 0; box-shadow: none; }
  .public-header .button { display: none; }
  .public-page { padding: 18px; }
  .public-hero h1 { font-size: 37px; }
  .metric-card small { font-size: 10px; }
  .agenda-navigation { width: 100%; flex-wrap: wrap; }
  .agenda-date-copy { order: -1; width: 100%; margin: 0 0 3px; }
  .agenda-date-form { flex: 1; }
  .agenda-actions { flex-direction: column; }
  .agenda-actions .button { width: 100%; }
  .agenda-legend { display: none; }
  .schedule-times { grid-template-columns: 1fr 1fr; }
  .link-button { padding: 8px 4px; font-weight: 700; color: var(--primary-dark); }
}

/* Operação: comandas, produtos, estoque e caixa */
.button-danger { background: #fff0f3; color: var(--danger); border-color: #ffd3dc; }
.button-danger:hover { background: #ffe5eb; }
.button.disabled { opacity: .48; pointer-events: none; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.status-warning { background: #fff7df; color: #946100; }
.status-neutral { background: #f0f1f5; color: #686c7e; }
.status-order-open { background: #eeeaff; color: var(--primary-dark); }
.status-order-closed { background: #e8f9f3; color: var(--success); }
.status-order-cancelled { background: #fff0f3; color: var(--danger); }
.metric-card.metric-warning { border-color: #f1d28b; background: #fffbef; }
.metric-money { font-size: clamp(20px, 2vw, 28px) !important; }
.metric-text { font-size: 24px !important; }
.panel-head-actions { display: flex; align-items: center; gap: 8px; }
.filter-bar-wrap { flex-wrap: wrap; }
.filter-bar select { min-width: 165px; border: 1px solid #dcdde7; border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--ink); outline: none; }
.filter-bar select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px #7167f917; }
.table-actions { white-space: nowrap; }
.read-only-value { min-height: 44px; display: flex; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8f8fb; font-weight: 750; }
.compact-form { grid-template-columns: 1fr; padding: 18px; gap: 14px; }
.compact-form .field.full, .compact-form .form-actions { grid-column: auto; }
.compact-form .form-actions { padding-top: 14px; }
.compact-empty { padding: 34px 18px; }

.detail-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 16px; padding: 2px 2px; }
.detail-header h2 { margin: 5px 0 4px; font-size: 25px; }
.detail-header p { margin: 0; color: var(--muted); }
.back-link { color: var(--muted); font-size: 12px; font-weight: 700; }
.back-link:hover { color: var(--primary-dark); }
.detail-title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title-line h2 { margin-right: 3px; }
.stock-balance { min-width: 160px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; display: grid; text-align: right; }
.stock-balance span, .stock-balance small { color: var(--muted); font-size: 11px; }
.stock-balance strong { font-size: 28px; line-height: 1.05; }
.stock-balance.low { border-color: #f1d28b; background: #fffbef; }
.two-column-layout { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(420px, 1.25fr); gap: 16px; align-items: start; }
.inventory-layout > .panel:first-child { position: sticky; top: 104px; }
.movement-list { display: grid; }
.movement-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.movement-item:last-child { border-bottom: 0; }
.movement-sign { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-weight: 850; }
.movement-sign.positive { background: #e8f9f3; color: var(--success); }
.movement-sign.negative { background: #fff0f3; color: var(--danger); }
.movement-copy, .movement-values { display: grid; min-width: 0; }
.movement-copy span, .movement-copy small, .movement-values small { color: var(--muted); font-size: 11px; }
.movement-copy strong, .movement-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movement-values { text-align: right; }

.linked-appointment { margin: 16px 22px 0; padding: 13px 14px; display: flex; align-items: center; gap: 11px; border: 1px solid #dcd8ff; background: #f7f5ff; border-radius: 13px; }
.linked-appointment.compact-linked { margin: 0 0 16px; }
.linked-appointment > div { display: grid; flex: 1; min-width: 0; }
.linked-appointment span { color: var(--muted); font-size: 12px; }
.linked-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary-dark) !important; font-size: 17px !important; }
.order-header-actions { display: flex; gap: 8px; }
.order-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.order-main-column { display: grid; gap: 16px; min-width: 0; }
.order-summary-column { min-width: 0; }
.sticky-summary { position: sticky; top: 104px; }
.order-items-list { display: grid; }
.order-item-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.order-item-row:last-child { border-bottom: 0; }
.order-item-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-size: 17px; }
.order-item-icon.service { background: var(--primary-soft); color: var(--primary-dark); }
.order-item-icon.product { background: #e9f8f6; color: #138777; }
.order-item-copy, .order-item-values { display: grid; min-width: 0; }
.order-item-copy span, .order-item-values small { color: var(--muted); font-size: 11px; }
.order-item-copy strong, .order-item-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-item-values { text-align: right; }
.icon-action { width: 31px; height: 31px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 9px; display: inline-grid; place-items: center; font-size: 18px; line-height: 1; }
.icon-action.danger:hover { color: var(--danger); border-color: #ffd0d9; background: #fff3f5; }
.add-items-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.add-item-card .panel-head { padding: 17px 18px; }
.add-item-card .panel-head h2 { font-size: 16px; }
.add-item-card .inline-empty { margin: 18px; }
.order-summary-lines { display: grid; padding: 6px 18px 18px; }
.order-summary-lines > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.order-summary-lines span { color: var(--muted); }
.order-summary-lines .total { border-bottom: 0; padding-top: 17px; align-items: end; }
.order-summary-lines .total span { color: var(--ink); font-weight: 750; }
.order-summary-lines .total strong { font-size: 25px; color: var(--primary-dark); }
.sticky-summary > .button-block { width: calc(100% - 36px); margin: 0 18px 16px; }
.cash-warning { margin: 0 18px 14px; padding: 12px; border-radius: 11px; background: #fff8e6; color: #805c0b; display: grid; }
.cash-warning span { font-size: 11px; opacity: .78; }
.cash-warning a { font-size: 12px; font-weight: 750; margin-top: 4px; }
.cancel-order-form { text-align: center; padding: 0 18px 18px; }
.link-danger { border: 0; background: transparent; color: var(--danger); font-size: 12px; font-weight: 700; padding: 8px; }
.payment-receipt { display: grid; gap: 9px; padding: 0 18px 18px; }
.payment-receipt > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.payment-receipt > div span { color: var(--muted); }
.payment-receipt small { color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }

.payment-panel { max-width: 1040px; margin: 0 auto; }
.payment-layout { display: grid; grid-template-columns: .8fr 1.2fr; }
.payment-items { padding: 22px; border-right: 1px solid var(--line); background: #fafafd; }
.payment-items > div { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.payment-items span { color: var(--muted); }
.payment-items .discount strong { color: var(--danger); }
.payment-items .payment-grand-total { border: 0; padding-top: 20px; align-items: end; }
.payment-grand-total span { color: var(--ink); font-weight: 750; }
.payment-grand-total strong { font-size: 28px; color: var(--primary-dark); }
.payment-form { padding: 22px; }
.payment-form-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.payment-form-head > div { display: grid; }
.payment-form-head small { color: var(--muted); }
.payment-rows { display: grid; gap: 9px; }
.payment-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(130px, .85fr) 70px 32px; gap: 8px; align-items: center; }
.payment-row select, .payment-row input { width: 100%; min-width: 0; border: 1px solid #dcdde7; border-radius: 10px; padding: 10px; background: #fff; outline: none; }
.payment-row .input-prefix input { border: 0; }
.payment-row [data-payment-installments].is-disabled { opacity: .45; background: #f4f4f7; pointer-events: none; }
.payment-balance { margin: 18px 0; padding: 13px 14px; border-radius: 12px; background: #f3f2ff; display: grid; grid-template-columns: 1fr auto; }
.payment-balance small { grid-column: 1 / -1; color: var(--muted); }
.payment-balance.invalid { background: #fff0f3; color: var(--danger); }

.cash-open-panel { margin-bottom: 18px; }
.cash-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.cash-main-column, .cash-side-column { display: grid; gap: 16px; min-width: 0; }
.cash-side-column { position: sticky; top: 104px; }
.cash-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 8px 18px 18px; }
.cash-summary-grid > div { display: grid; padding: 14px; border-right: 1px solid var(--line); }
.cash-summary-grid > div:nth-child(4) { border-right: 0; }
.cash-summary-grid span { color: var(--muted); font-size: 11px; }
.cash-summary-grid strong { font-size: 17px; }
.cash-summary-grid .cash-expected { grid-column: 1 / -1; border: 1px solid #dcd8ff; background: #f5f3ff; border-radius: 12px; margin-top: 7px; text-align: center; }
.cash-summary-grid .cash-expected strong { font-size: 26px; color: var(--primary-dark); }
.payment-breakdown { display: grid; padding: 8px 18px 18px; }
.payment-breakdown > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.payment-breakdown > div:last-child { border-bottom: 0; }
.payment-breakdown span { display: grid; }
.payment-breakdown small { color: var(--muted); font-size: 10px; }
.close-cash-panel { border-color: #f3ccd5; }
.cash-history-panel { margin-top: 16px; }
.dashboard-quick-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1180px) {
  .order-page-grid { grid-template-columns: minmax(0, 1fr) 290px; }
  .add-items-grid { grid-template-columns: 1fr; }
  .cash-summary-grid { grid-template-columns: 1fr 1fr; }
  .cash-summary-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .dashboard-quick-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 980px) {
  .two-column-layout, .cash-page-grid, .order-page-grid { grid-template-columns: 1fr; }
  .inventory-layout > .panel:first-child, .cash-side-column, .sticky-summary { position: static; }
  .order-summary-column { order: -1; }
  .payment-layout { grid-template-columns: 1fr; }
  .payment-items { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .detail-header { align-items: flex-start; flex-direction: column; }
  .stock-balance { width: 100%; text-align: left; }
  .order-header-actions { width: 100%; }
  .order-header-actions .button { flex: 1; }
  .linked-appointment { margin: 13px 15px 0; align-items: flex-start; }
  .linked-appointment.compact-linked { margin: 0 0 13px; }
  .linked-appointment .button { display: none; }
  .payment-row { grid-template-columns: 1fr 1fr 32px; }
  .payment-row > select:first-child { grid-column: 1 / -1; }
  .payment-row [data-payment-installments] { grid-column: 2; }
  .payment-row [data-remove-payment] { grid-column: 3; grid-row: 2; }
  .movement-item { grid-template-columns: 32px minmax(0, 1fr); }
  .movement-values { grid-column: 2; text-align: left; margin-top: 3px; }
  .cash-summary-grid { grid-template-columns: 1fr; }
  .cash-summary-grid .cash-expected { grid-column: auto; }
  .panel-head-actions { width: 100%; }
  .panel-head-actions .button { flex: 1; }
}

@media (max-width: 590px) {
  .filter-bar select, .filter-bar input, .filter-bar .button { width: 100%; max-width: none; }
  .dashboard-quick-grid { grid-template-columns: 1fr; }
  .order-item-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 12px; }
  .order-item-values { grid-column: 2; text-align: left; }
  .order-item-row form { grid-column: 3; grid-row: 1 / 3; }
  .add-items-grid { gap: 12px; }
  .payment-form-head { align-items: stretch; flex-direction: column; }
  .payment-row { grid-template-columns: minmax(0, 1fr) 32px; }
  .payment-row > select:first-child, .payment-row .input-prefix, .payment-row [data-payment-installments] { grid-column: 1; }
  .payment-row [data-remove-payment] { grid-column: 2; grid-row: 1 / 4; }
  .payment-balance { grid-template-columns: 1fr; }
  .payment-balance strong { margin-top: 4px; }
  .order-detail-header .detail-title-line h2 { font-size: 22px; }
  .responsive-table { min-width: 0; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .responsive-table td { display: flex; justify-content: space-between; gap: 15px; padding: 6px 0; border: 0; text-align: right; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
  .responsive-table td > * { max-width: 68%; }
  .responsive-table .table-sub { text-align: right; }
  .responsive-table .table-actions { white-space: normal; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .overlay, .alert { display: none !important; }
  .app-shell { display: block; }
  .content { max-width: none; padding: 0; }
  .panel, .linked-appointment { box-shadow: none; break-inside: avoid; }
  .order-page-grid { grid-template-columns: 1fr 280px; }
  .sticky-summary { position: static; }
}
