:root {
  --ink: #17251f;
  --muted: #6c7771;
  --line: #e4e9e6;
  --paper: #ffffff;
  --canvas: #f4f6f4;
  --brand: #1f6a4c;
  --brand-dark: #154a36;
  --brand-soft: #e5f2eb;
  --amber: #b66b16;
  --amber-soft: #fff2df;
  --red: #b33a3a;
  --red-soft: #fdeaea;
  --blue: #356aa0;
  --blue-soft: #e8f0fa;
  --shadow: 0 12px 36px rgba(23, 37, 31, .08);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 520px) 1fr; background: var(--paper); }
.login-panel { padding: clamp(32px, 7vw, 88px); display: flex; flex-direction: column; justify-content: center; }
.login-art { margin: 20px; border-radius: 28px; padding: clamp(40px, 7vw, 100px); display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(145deg, rgba(15,59,42,.85), rgba(31,106,76,.97)), radial-gradient(circle at 70% 20%, #87a992 0 3%, transparent 4%); color: white; overflow: hidden; position: relative; }
.login-art::before, .login-art::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; width: 380px; height: 380px; right: -100px; top: -90px; }
.login-art::after { width: 250px; height: 250px; right: -10px; top: 20px; }
.login-art h2 { font-size: clamp(34px, 4vw, 64px); max-width: 780px; line-height: 1.05; letter-spacing: -.04em; position: relative; }
.login-art p { max-width: 570px; color: rgba(255,255,255,.72); font-size: 17px; position: relative; }
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 54px; font-weight: 750; font-size: 20px; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: white; background: var(--brand); font-weight: 800; }
.login-panel h1 { font-size: 34px; margin-bottom: 8px; letter-spacing: -.03em; }
.login-form { margin-top: 32px; max-width: 400px; }
.demo-note { margin-top: 24px; max-width: 400px; padding: 13px 15px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; line-height: 1.5; }

.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field label, .label { font-size: 13px; font-weight: 700; color: #445149; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 44px; border: 1px solid #dce3df; border-radius: 11px; background: white; padding: 10px 12px; color: var(--ink); outline: none; transition: .2s; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,106,76,.1); }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 18px; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); padding: 8px 13px; background: white; color: var(--ink); font-weight: 700; font-size: 13px; transition: .18s; text-decoration: none; }
.btn:hover { transform: translateY(-1px); border-color: #c5cec9; }
.btn.primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--red); border-color: #efc7c7; background: var(--red-soft); }
.btn.soft { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.btn.warning { background: var(--amber-soft); color: #8a5011; border-color: transparent; }
.btn.wide { width: 100%; min-height: 46px; }
.btn.icon { width: 40px; padding: 0; font-size: 18px; }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 242px; padding: 28px 18px 20px; background: #13271e; color: white; display: flex; flex-direction: column; z-index: 20; }
.sidebar .brand { padding: 0 10px; margin-bottom: 35px; }
.sidebar .brand-mark { background: #d9ede2; color: var(--brand-dark); }
.nav { display: grid; gap: 5px; }
.nav button { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; padding: 11px 13px; color: rgba(255,255,255,.62); background: transparent; text-align: left; font-weight: 650; }
.nav button:hover, .nav button.active { background: rgba(255,255,255,.1); color: white; }
.nav-icon { width: 23px; text-align: center; font-size: 17px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 18px 8px 0; }
.user-mini { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; margin-bottom: 13px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #d9ede2; color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; }
.user-mini strong, .user-mini span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini strong { font-size: 13px; }
.user-mini span { color: rgba(255,255,255,.55); font-size: 11px; text-transform: capitalize; margin-top: 2px; }
.logout { border: 0; background: transparent; padding: 4px 0; color: rgba(255,255,255,.6); font-weight: 650; }
.logout:hover { color: white; }
.main { grid-column: 2; min-width: 0; padding: 24px clamp(20px, 4vw, 56px) 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 54px; margin-bottom: 28px; }
.topbar small { display: block; color: var(--muted); margin-bottom: 2px; }
.topbar strong { font-size: 15px; }
.mobile-menu { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 23px; }
.page-head h1 { margin-bottom: 5px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 25px; }
.stat { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; }
.stat-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 19px; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.stat b { display: block; font-size: 28px; letter-spacing: -.04em; }
.stat small { color: var(--muted); }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.panel-head h2, .panel h2 { font-size: 17px; margin: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick { border: 1px solid var(--line); border-radius: 13px; background: white; padding: 17px; text-align: left; }
.quick:hover { border-color: var(--brand); }
.quick b { display: block; margin: 12px 0 4px; }
.quick span { color: var(--muted); font-size: 12px; }

.dashboard-charts { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr) minmax(280px, .85fr); gap: 14px; margin-bottom: 18px; }
.dashboard-charts .panel { margin: 0; }
.chart-panel { min-width: 0; min-height: 318px; }
.chart-panel .panel-head { align-items: flex-start; }
.chart-panel .panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.chart-panel .panel-head > strong { color: var(--brand); font-size: 16px; white-space: nowrap; }
.revenue-bars { height: 220px; display: flex; align-items: stretch; justify-content: space-around; gap: 9px; padding-top: 8px; }
.revenue-day { flex: 1; min-width: 0; display: grid; grid-template-rows: 20px 1fr 18px; gap: 7px; text-align: center; }
.revenue-day > b { color: var(--muted); font-size: 10px; font-weight: 700; }
.revenue-day > small { color: var(--muted); font-size: 10px; }
.revenue-track { height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 8px; background: linear-gradient(to top, #f1f5f3, transparent); overflow: hidden; }
.revenue-track i { display: block; width: min(34px, 72%); min-height: 2px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #43a77e, var(--brand)); transition: height .35s ease; }
.status-chart { display: grid; grid-template-columns: 136px 1fr; gap: 17px; align-items: center; min-height: 220px; }
.donut { width: 136px; height: 136px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.03); }
.donut span { width: 88px; height: 88px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: white; box-shadow: 0 2px 9px rgba(20,45,33,.08); }
.donut b, .donut small { display: block; }
.donut b { font-size: 25px; line-height: 1; }
.donut small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.chart-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.chart-legend li { display: grid; grid-template-columns: 8px 1fr auto; gap: 7px; align-items: center; font-size: 10px; }
.chart-legend li > i { width: 8px; height: 8px; border-radius: 50%; }
.chart-legend li > span { color: var(--muted); }
.chart-legend li > b { font-size: 10px; }
.seller-list { display: grid; gap: 16px; padding-top: 2px; }
.seller-row { display: grid; grid-template-columns: 25px 1fr; gap: 9px; align-items: center; }
.seller-rank { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 850; }
.seller-copy { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.seller-copy b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.seller-copy small { flex: none; color: var(--muted); font-size: 9px; }
.seller-track { height: 6px; overflow: hidden; border-radius: 99px; background: #edf1ef; }
.seller-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #63b994); }
.empty.compact { padding: 25px 12px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 11px 10px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 13px 10px; border-bottom: 1px solid #edf0ee; vertical-align: middle; font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td strong { display: block; }
.data-table td small { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 5px 8px; border-radius: 999px; background: #edf0ee; color: #59645e; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.badge.available, .badge.ready, .badge.completed, .badge.paid, .badge.active, .badge.confirmed { background: var(--brand-soft); color: var(--brand); }
.badge.occupied, .badge.preparing, .badge.submitted, .badge.seated { background: var(--amber-soft); color: #965712; }
.badge.reserved, .badge.approved { background: var(--blue-soft); color: var(--blue); }
.badge.rejected, .badge.cancelled, .badge.low, .badge.inactive { background: var(--red-soft); color: var(--red); }
.badge.draft, .badge.served { background: #eef0f7; color: #5d6282; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; }
.item-card, .order-card, .table-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.item-card { padding: 0; overflow: hidden; }
.item-card-body { padding: 17px; }
.menu-image-wrap { position: relative; display: block; height: 180px; overflow: hidden; background: linear-gradient(135deg, var(--brand-soft), #f5eee3); }
.menu-image { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .3s ease; }
.item-card:hover .menu-image { transform: scale(1.025); }
.menu-image-fallback { display: none; position: absolute; inset: 0; place-items: center; color: var(--brand); font-size: 28px; font-weight: 850; letter-spacing: .08em; }
.missing .menu-image-fallback { display: grid; }
.item-card-head, .order-top, .table-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item-card h3, .order-card h3, .table-card h3 { font-size: 16px; margin-bottom: 5px; }
.item-card p { color: var(--muted); font-size: 12px; line-height: 1.5; min-height: 36px; }
.price { color: var(--brand); font-weight: 800; }
.order-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; background: var(--canvas); border-radius: 10px; padding: 10px; margin: 13px 0; font-size: 12px; }
.order-meta span { color: var(--muted); display: block; margin-bottom: 2px; }
.order-items { margin: 0 0 13px; padding: 0; list-style: none; }
.order-items li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 12px; border-bottom: 1px dashed var(--line); }
.order-total { display: flex; justify-content: space-between; font-weight: 800; padding: 9px 0 14px; }
.reason { background: var(--red-soft); color: #8c3030; padding: 9px 10px; border-radius: 9px; font-size: 12px; margin-bottom: 12px; }
.table-card { min-height: 142px; }
.table-card .capacity { color: var(--muted); font-size: 13px; margin-top: 25px; }
.table-card.available { border-top: 3px solid var(--brand); }
.table-card.occupied { border-top: 3px solid var(--amber); }
.table-card.reserved { border-top: 3px solid var(--blue); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); border: 1px dashed #ccd5d0; border-radius: 14px; background: rgba(255,255,255,.45); }
.empty b { display: block; color: var(--ink); margin-bottom: 6px; }
.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters .input { max-width: 220px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10,21,16,.55); display: grid; place-items: center; padding: 18px; z-index: 100; backdrop-filter: blur(3px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 36px); overflow: auto; border-radius: 19px; background: white; box-shadow: 0 22px 70px rgba(0,0,0,.2); }
.modal.wide { width: min(960px, 100%); }
.modal-head { position: sticky; top: 0; background: white; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: white; border-top: 1px solid var(--line); }
.close { border: 0; width: 34px; height: 34px; border-radius: 9px; background: var(--canvas); font-size: 20px; color: var(--muted); }
.builder { display: grid; grid-template-columns: 1.3fr .8fr; gap: 18px; }
.builder-menu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; max-height: 460px; overflow: auto; padding-right: 4px; }
.builder-item { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: white; border-radius: 11px; padding: 7px; overflow: hidden; }
.builder-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.builder-item-copy, .builder-item-copy b, .builder-item-copy span { display: block; }
.builder-item-copy > span { color: var(--brand); margin-top: 5px; font-size: 12px; font-weight: 750; }
.builder-image-wrap { position: relative; display: block; width: 64px; height: 64px; overflow: hidden; border-radius: 8px; background: linear-gradient(135deg, var(--brand-soft), #f5eee3); }
.builder-image { width: 100%; height: 100%; display: block; object-fit: cover; }
.builder-image-wrap .menu-image-fallback { font-size: 15px; }
.cart { background: var(--canvas); border-radius: 13px; padding: 13px; }
.cart-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qty { display: flex; gap: 4px; align-items: center; }
.qty button { border: 1px solid var(--line); background: white; width: 26px; height: 26px; border-radius: 7px; }
.cart-total { display: flex; justify-content: space-between; padding-top: 13px; font-weight: 800; }
.notification { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.notification:last-child { border-bottom: 0; }
.notification .dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notification.unread .dot { background: var(--brand); }
.notification p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.notification time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 70px; align-items: center; gap: 10px; font-size: 12px; margin: 12px 0; }
.bar-track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar { height: 100%; border-radius: 99px; background: var(--brand); }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; max-width: min(390px, calc(100vw - 32px)); padding: 13px 17px; border-radius: 11px; background: var(--ink); color: white; font-size: 13px; box-shadow: var(--shadow); transform: translateY(25px); opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: var(--red); }

.invoice-page { background: #edf0ee; padding: 35px 16px; }
.invoice { width: min(800px, 100%); margin: auto; background: white; padding: 42px; border-radius: 8px; box-shadow: var(--shadow); }
.invoice header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 28px; }
.invoice header > div:first-child { display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; }
.invoice header h1 { margin: 0; font-size: 22px; }
.invoice header p { grid-column: 2; color: var(--muted); font-size: 12px; }
.invoice-meta { display: grid; justify-items: end; gap: 4px; font-size: 12px; color: var(--muted); }
.invoice-meta strong { color: var(--ink); font-size: 24px; }
.invoice-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 25px 0; }
.invoice-info small, .invoice-info strong { display: block; }
.invoice-info small { color: var(--muted); margin-bottom: 4px; }
.invoice table { width: 100%; border-collapse: collapse; }
.invoice th, .invoice td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.invoice th { color: var(--muted); }
.invoice-totals { width: min(330px, 100%); margin: 24px 0 24px auto; }
.invoice-totals p { display: flex; justify-content: space-between; font-size: 13px; }
.invoice-totals .grand { border-top: 2px solid var(--ink); padding-top: 12px; font-size: 17px; }
.invoice footer { text-align: center; color: var(--muted); }

@media (max-width: 1050px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .revenue-panel { grid-column: 1 / -1; }
  .card-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .login-art { padding: 50px; }
}

@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; padding: 32px 24px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-102%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .main { padding: 14px 16px 80px; }
  .mobile-menu { display: inline-flex; }
  .topbar { margin-bottom: 18px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .btns { width: 100%; }
  .stats, .card-grid, .quick-grid, .report-grid, .dashboard-charts { grid-template-columns: 1fr; }
  .revenue-panel { grid-column: auto; }
  .status-chart { grid-template-columns: 120px 1fr; }
  .donut { width: 120px; height: 120px; }
  .field-row, .field-row.three { grid-template-columns: 1fr; gap: 0; }
  .builder { grid-template-columns: 1fr; }
  .builder-menu { max-height: 280px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .invoice { padding: 24px 18px; }
  .invoice header { flex-direction: column; gap: 20px; }
  .invoice-meta { justify-items: start; }
  .invoice-info { grid-template-columns: 1fr 1fr; }
}

@media print {
  .no-print { display: none !important; }
  .invoice-page { padding: 0; background: white; }
  .invoice { width: 100%; box-shadow: none; padding: 20px; }
}
