:root {
  --red: #c9232c;
  --red-dark: #921820;
  --red-soft: #fff0f0;
  --cream: #f7f3e9;
  --cream-2: #efe8d8;
  --ink: #261c18;
  --muted: #756a65;
  --line: #e5ddd3;
  --white: #ffffff;
  --green: #16865b;
  --amber: #b86c05;
  --blue: #2865b1;
  --shadow: 0 16px 40px rgba(58, 35, 29, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.positive { color: var(--green); }
.negative { color: var(--red-dark); }
.eyebrow { margin: 0 0 8px; color: var(--red); font-size: 11px; font-weight: 850; letter-spacing: .15em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; border-radius: 12px; font-weight: 750; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(201, 35, 44, .22); outline-offset: 2px; }
.button.primary { color: #fff; background: var(--red); box-shadow: 0 8px 20px rgba(201,35,44,.22); }
.button.primary:hover { background: var(--red-dark); }
.button.dark { color: #fff; background: var(--ink); }
.button.ghost { color: var(--ink); border-color: var(--line); background: var(--white); }
.button.soft { color: var(--red-dark); background: var(--red-soft); }
.button.small { min-height: 34px; padding: 7px 11px; border-radius: 10px; font-size: 13px; }
.button.icon { width: 42px; padding: 0; }
.button.wide { width: 100%; }
.button[disabled] { opacity: .6; cursor: wait; transform: none; }

.install-body { background: radial-gradient(circle at 10% 10%, #fff 0, transparent 32%), var(--cream); }
.install-shell { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(500px, 1.18fr); width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 60px); margin: 30px auto; overflow: hidden; border: 1px solid rgba(80,52,42,.08); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.install-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 5vw, 76px); color: #fff; background: linear-gradient(145deg, var(--red-dark), var(--red) 60%, #e4483d); }
.install-brand img { width: 144px; margin-bottom: 46px; border: 7px solid #fff; border-radius: 30px; box-shadow: 0 16px 32px rgba(55, 7, 7, .22); }
.install-brand .eyebrow { color: #ffd99a; }
.install-brand h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(38px, 5vw, 65px); line-height: .98; letter-spacing: -.04em; }
.install-brand > p:not(.eyebrow) { max-width: 460px; color: rgba(255,255,255,.84); font-size: 17px; }
.check-list { display: grid; gap: 9px; margin: 32px 0 0; padding: 0; list-style: none; }
.check-list li { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.check-list li span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.17); font-weight: 900; }
.check-list .bad { color: #ffe1b8; }
.install-card { padding: clamp(28px, 4vw, 58px); align-self: center; }
.section-heading, .page-heading, .card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2, .card-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.step-badge { padding: 6px 10px; border-radius: 999px; color: var(--red-dark); background: var(--red-soft); font-weight: 800; font-size: 12px; }
.success-panel { max-width: 480px; margin: auto; text-align: center; }
.success-panel .button { margin-top: 10px; }
.success-mark { display: grid; width: 74px; height: 74px; margin: 0 auto 22px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-size: 36px; font-weight: 900; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span, .field-label { color: #514641; font-size: 12px; font-weight: 800; letter-spacing: .015em; }
.field small, .toggle small { color: var(--muted); font-size: 11px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #aa9f99; }
.form-divider { position: relative; margin-top: 5px; border-top: 1px solid var(--line); }
.form-divider span { position: relative; top: -11px; padding-right: 10px; color: var(--red-dark); background: #fff; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.toggle { display: grid; grid-template-columns: 46px 1fr; align-items: center; column-gap: 11px; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; }
.toggle > span { grid-row: 1 / 3; width: 44px; height: 25px; border-radius: 999px; background: #d7cfca; transition: .2s; }
.toggle > span::after { display: block; width: 19px; height: 19px; margin: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); content: ""; transition: .2s; }
.toggle input:checked + span { background: var(--red); }
.toggle input:checked + span::after { transform: translateX(19px); }
.toggle input:focus-visible + span { outline: 3px solid rgba(201, 35, 44, .22); outline-offset: 2px; }
.alert { padding: 12px 15px; border-radius: 12px; font-size: 14px; }
.alert.danger { color: #861820; border: 1px solid #f1b9bc; background: #fff0f0; }
.alert.success { color: #096645; border: 1px solid #b5dfcf; background: #edf9f4; }
.alert.warning { color: #774500; border: 1px solid #edd0a4; background: #fff8e8; }

.login-body { display: grid; place-items: center; padding: 24px; background: linear-gradient(120deg, var(--cream), #fff 60%); }
.login-shell { display: grid; grid-template-columns: .9fr 1.1fr; width: min(960px, 100%); min-height: 590px; overflow: hidden; border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.login-art { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 46px; color: #fff; background: linear-gradient(160deg, #711018, var(--red) 60%, #ef6b43); }
.login-art::before { position: absolute; inset: 25px 25px auto auto; width: 210px; height: 210px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; content: ""; }
.login-art img { position: relative; width: 152px; margin-bottom: auto; border: 7px solid white; border-radius: 31px; box-shadow: 0 18px 35px rgba(65,9,9,.23); }
.login-art h1 { margin: 0; font-family: Georgia, serif; font-size: 48px; line-height: 1; }
.login-art p { color: rgba(255,255,255,.8); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 72px); }
.language-pills { display: flex; gap: 6px; }
.language-pills a { padding: 7px 10px; border-radius: 9px; color: var(--muted); font-size: 12px; font-weight: 800; }
.language-pills a.active { color: var(--red-dark); background: var(--red-soft); }
.login-panel .language-pills { align-self: flex-end; margin-bottom: 48px; }
.login-panel h2 { margin: 0 0 6px; font-size: 31px; letter-spacing: -.035em; }
.login-panel form { display: grid; gap: 17px; margin-top: 28px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: 264px; flex-direction: column; color: #fff; background: linear-gradient(180deg, #a31820, var(--red) 58%, #8a151c); box-shadow: 8px 0 25px rgba(69,18,13,.08); }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 17px; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand img { width: 58px; height: 58px; object-fit: cover; border: 4px solid #fff; border-radius: 15px; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 22px; letter-spacing: -.02em; }
.brand small { color: rgba(255,255,255,.7); font-size: 10px; letter-spacing: .09em; }
.nav { display: grid; gap: 3px; overflow-y: auto; padding: 15px 12px; }
.nav a { display: flex; min-height: 42px; align-items: center; gap: 12px; padding: 9px 13px; border-radius: 11px; color: rgba(255,255,255,.78); font-size: 14px; font-weight: 650; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.09); }
.nav a.active { color: var(--red-dark); background: #fff; box-shadow: 0 8px 18px rgba(64,8,8,.14); }
.nav .nav-icon { width: 21px; text-align: center; font-size: 16px; }
.sidebar-user { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.13); }
.user-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: var(--red-dark); background: #fff; font-weight: 900; }
.user-row strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-row small { display: block; overflow: hidden; max-width: 130px; color: rgba(255,255,255,.7); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 9px; color: #fff; background: rgba(255,255,255,.1); }
.content-shell { min-height: 100vh; margin-left: 264px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 20px; padding: 13px clamp(20px, 3.3vw, 48px); border-bottom: 1px solid rgba(94,70,60,.1); background: rgba(247,243,233,.94); backdrop-filter: blur(12px); }
.topbar-title h1 { margin: 0; font-size: clamp(22px, 2vw, 30px); letter-spacing: -.035em; }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar-tools { display: flex; align-items: center; gap: 14px; }
.mobile-menu { display: none; border: 0; color: var(--red-dark); background: transparent; font-size: 24px; }
.page { width: min(1500px, 100%); margin: 0 auto; padding: 30px clamp(18px, 3.3vw, 48px) 60px; }
.page-heading { margin-bottom: 22px; align-items: center; }
.page-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.food-banner { position: relative; height: 178px; margin-bottom: 18px; overflow: hidden; border-radius: var(--radius); background: var(--red-dark); box-shadow: var(--shadow); }
.food-banner::after { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(48,19,14,.92), rgba(70,21,17,.42) 48%, transparent 78%); content: ""; }
.food-banner img { width: 100%; height: 100%; object-fit: cover; }
.food-banner > div { position: absolute; z-index: 1; top: 50%; left: clamp(20px, 4vw, 48px); display: flex; max-width: 430px; flex-direction: column; transform: translateY(-50%); color: #fff; }
.food-banner .eyebrow { color: #ffd99a; }
.food-banner strong { font-family: Georgia, serif; font-size: clamp(24px, 3vw, 40px); line-height: 1; letter-spacing: -.03em; }
.food-banner span { margin-top: 8px; color: rgba(255,255,255,.75); font-size: 12px; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.aside-main { grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr); align-items: start; }
.card { min-width: 0; padding: 21px; border: 1px solid rgba(96,70,60,.1); border-radius: var(--radius); background: #fff; box-shadow: 0 8px 25px rgba(73,46,37,.045); }
.card-heading { align-items: center; margin-bottom: 18px; }
.card-heading h2 { font-size: 18px; }
.card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.card.accent { color: #fff; border: 0; background: linear-gradient(135deg, #99171f, var(--red)); }
.card.accent .muted { color: rgba(255,255,255,.72); }
.kpi { position: relative; min-height: 138px; overflow: hidden; }
.kpi::after { position: absolute; right: -26px; bottom: -38px; width: 100px; height: 100px; border-radius: 50%; background: var(--red-soft); content: ""; }
.kpi.accent::after { background: rgba(255,255,255,.1); }
.kpi-icon { display: grid; width: 38px; height: 38px; margin-bottom: 19px; place-items: center; border-radius: 11px; color: var(--red-dark); background: var(--red-soft); }
.accent .kpi-icon { color: #fff; background: rgba(255,255,255,.15); }
.kpi p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi strong { position: relative; z-index: 1; display: block; margin-top: 5px; font-size: 27px; letter-spacing: -.04em; }
.kpi small { color: var(--muted); }
.accent.kpi p, .accent.kpi small { color: rgba(255,255,255,.72); }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; color: #776a64; background: #faf8f4; font-size: 10px; font-weight: 850; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
td { padding: 12px; border-top: 1px solid #eee8e1; vertical-align: middle; }
tbody tr:hover { background: #fffcf8; }
.product-cell { display: flex; min-width: 190px; align-items: center; gap: 9px; }
.product-icon { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--cream); font-size: 18px; }
.product-cell strong { display: block; }
.product-cell small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; color: #5e514b; background: #f1ece6; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge::before { width: 6px; height: 6px; border-radius: 50%; background: #9b8e88; content: ""; }
.badge.success { color: #0b6646; background: #e9f8f2; }
.badge.success::before { background: var(--green); }
.badge.warning { color: #8a5201; background: #fff3d9; }
.badge.warning::before { background: #d88812; }
.badge.danger { color: #921820; background: #ffe9ea; }
.badge.danger::before { background: var(--red); }
.empty { padding: 34px; color: var(--muted); text-align: center; }

.line-items { grid-column: 1 / -1; display: grid; gap: 9px; }
.line-row { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(2, minmax(100px, .7fr)) minmax(90px, .75fr) minmax(120px, .9fr) 38px; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #faf8f4; }
.line-row.recipe-line { grid-template-columns: minmax(200px, 2fr) minmax(100px, .8fr) minmax(100px, .8fr) 38px; }
.line-row.sale-line { grid-template-columns: minmax(230px, 2fr) minmax(100px, .65fr) 38px; }
.remove-line { display: grid; width: 38px; height: 42px; place-items: center; border: 0; border-radius: 10px; color: var(--red-dark); background: var(--red-soft); font-size: 20px; }
.line-actions { display: flex; justify-content: flex-start; }
.helper { padding: 12px 14px; border-left: 3px solid var(--red); border-radius: 0 10px 10px 0; color: #645852; background: #faf6f0; font-size: 12px; }
.fiscal-box { padding: 15px; border: 1px solid #edd0a4; border-radius: 13px; color: #754706; background: #fff8e9; font-size: 12px; }
.fiscal-box strong { display: block; margin-bottom: 3px; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 16px; padding: 14px; border-radius: 13px; background: var(--ink); color: #fff; }
.summary-strip div { min-width: 120px; }
.summary-strip span { display: block; color: rgba(255,255,255,.6); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.summary-strip strong { font-size: 19px; }

.chart { position: relative; min-height: 260px; }
.chart canvas { width: 100%; height: 260px; }
.chart-empty { display: grid; min-height: 250px; place-items: center; color: var(--muted); }
.filters { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.range-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.range-pills button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 11px; font-weight: 750; }
.metric-list { display: grid; gap: 11px; }
.metric-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.metric-row:last-child { border: 0; }
.metric-row span { color: var(--muted); }
.metric-row strong { font-size: 14px; }

.settings-rate { display: grid; grid-template-columns: 70px repeat(4, 1fr); gap: 8px; align-items: end; }
.rate-flag { display: grid; height: 44px; place-items: center; border-radius: 11px; color: var(--red-dark); background: var(--red-soft); font-weight: 900; }
.audit-detail { max-width: 330px; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.fatal { width: min(620px, calc(100% - 40px)); margin: 12vh auto; padding: 34px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.ticket-body { padding: 24px; background: #ece8e1; }
.ticket { width: min(430px, 100%); margin: auto; padding: 28px; border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.ticket > img { display: block; width: 90px; margin: auto; }
.ticket h1 { margin: 14px 0 4px; text-align: center; }
.ticket-label { padding: 8px; border: 1px dashed var(--red); color: var(--red-dark); font-size: 10px; font-weight: 900; text-align: center; }
.ticket dl { margin: 20px 0; }
.ticket dl div { display: flex; justify-content: space-between; gap: 15px; padding: 4px 0; }
.ticket dt { color: var(--muted); }
.ticket dd { margin: 0; text-align: right; }
.ticket-total { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--ink); font-size: 20px; }
.ticket-actions { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }

@media (max-width: 1150px) {
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid.cols-4 .span-4 { grid-column: span 2; }
}

@media (max-width: 900px) {
  .install-shell { grid-template-columns: 1fr; }
  .install-brand { padding: 34px; }
  .install-brand img { width: 100px; margin-bottom: 24px; }
  .install-brand h1 { font-size: 42px; }
  .check-list { grid-template-columns: repeat(2, 1fr); }
  .login-shell { grid-template-columns: 1fr; }
  .login-art { min-height: 270px; padding: 28px; }
  .login-art img { width: 92px; }
  .login-art h1 { font-size: 38px; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .nav-open .sidebar { transform: translateX(0); }
  .nav-open::after { position: fixed; z-index: 25; inset: 0; background: rgba(32,20,17,.45); content: ""; }
  .content-shell { margin-left: 0; }
  .mobile-menu { display: block; }
  .topbar-title { margin-right: auto; }
  .grid.aside-main { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .install-shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; }
  .install-brand { min-height: 300px; }
  .check-list { grid-template-columns: 1fr; }
  .install-card { padding: 27px 20px 40px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .form-grid.cols-4 .span-4 { grid-column: span 1; }
  .login-body { padding: 0; }
  .login-shell { min-height: 100vh; border-radius: 0; }
  .login-panel { padding: 32px 24px 50px; }
  .topbar { min-height: 68px; padding: 10px 16px; }
  .topbar-title p { display: none; }
  .topbar-tools .language-pills a { padding: 6px; }
  .page { padding: 20px 14px 42px; }
  .food-banner { height: 150px; }
  .food-banner img { object-position: 48% center; }
  .food-banner::after { background: linear-gradient(90deg, rgba(48,19,14,.9), rgba(70,21,17,.45) 66%, transparent); }
  .food-banner > div { left: 18px; max-width: 250px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 15px; }
  .line-row, .line-row.recipe-line, .line-row.sale-line { grid-template-columns: 1fr 1fr; }
  .line-row .field:first-child { grid-column: 1 / -1; }
  .remove-line { align-self: end; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .button { width: 100%; }
  .settings-rate { grid-template-columns: 1fr 1fr; }
  .rate-flag { grid-column: 1 / -1; }
  .table-wrap { margin-right: -16px; width: calc(100% + 16px); border-right: 0; border-radius: 12px 0 0 12px; }
}

@media print {
  .ticket-body { padding: 0; background: #fff; }
  .ticket { width: 80mm; margin: 0; box-shadow: none; }
  .ticket-actions { display: none; }
}
