:root {
  --bg: #edf5fb;
  --panel: #f7fbff;
  --panel-2: #e8f2fb;
  --text: #172033;
  --muted: #6d7b91;
  --line: rgba(72, 104, 145, .18);
  --blue: #3f8cff;
  --blue-2: #75b7ff;
  --green: #17a878;
  --amber: #d89021;
  --red: #dc4c64;
  --shadow: 16px 16px 34px rgba(120, 151, 180, .28), -12px -12px 28px rgba(255, 255, 255, .9);
  --inset: inset 7px 7px 14px rgba(122, 151, 178, .18), inset -7px -7px 16px rgba(255, 255, 255, .88);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body {
  background:
    radial-gradient(circle at 8% 8%, rgba(255,255,255,.95), transparent 24rem),
    linear-gradient(135deg, #dceaf6 0%, #f7fbff 46%, #dbeaf7 100%);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.admin-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 22px; min-height: 100vh; padding: 24px; }
.sidebar {
  position: sticky; top: 24px; height: calc(100vh - 48px); overflow: auto; padding: 18px;
  border: 1px solid rgba(255,255,255,.65); border-radius: 22px; background: rgba(247,251,255,.76);
  box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center; color: white; font-weight: 900; background: linear-gradient(145deg, var(--blue), var(--blue-2)); box-shadow: 0 12px 24px rgba(63,140,255,.25); }
.brand-title { font-weight: 900; letter-spacing: .01em; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav-group { margin-top: 16px; }
.nav-label { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin: 8px 8px; }
.nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: #41506a;
  padding: 11px 12px; border-radius: 14px; text-align: left; font-weight: 800; margin: 3px 0;
}
.nav-btn:hover, .nav-btn.active { background: #f8fbff; color: var(--text); box-shadow: var(--inset); }
.nav-icon { width: 26px; height: 26px; border-radius: 10px; display: grid; place-items: center; background: #eaf4ff; color: var(--blue); font-size: 13px; flex: 0 0 auto; }
.sidebar-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.72); border-radius: 24px; background: rgba(247,251,255,.70);
  box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.title h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
.title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.content { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: rgba(247,251,255,.78); border: 1px solid rgba(255,255,255,.7); border-radius: 20px;
  box-shadow: var(--shadow); padding: 18px; min-width: 0;
}
.card.soft { box-shadow: var(--inset); background: rgba(239,247,253,.8); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card h2, .card h3 { margin: 0; font-size: 16px; }
.kpi { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.kpi .value { font-size: 28px; font-weight: 950; margin-top: 6px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 800; }
.kpi-icon { width: 48px; height: 48px; border-radius: 18px; display: grid; place-items: center; color: var(--blue); background: #edf6ff; box-shadow: var(--inset); font-weight: 900; }

.btn {
  border: 0; border-radius: 14px; padding: 10px 13px; font-weight: 900; color: white; background: linear-gradient(145deg, var(--blue), #62a9ff);
  box-shadow: 8px 8px 18px rgba(84,123,158,.24), -8px -8px 16px rgba(255,255,255,.8);
}
.btn:hover { filter: brightness(.99); transform: translateY(-1px); }
.btn.secondary { color: #33435d; background: #f4f9ff; box-shadow: var(--inset); }
.btn.danger { background: linear-gradient(145deg, #e95970, #c9364e); }
.btn.ok { background: linear-gradient(145deg, #24b987, #12966b); }
.btn.warn { background: linear-gradient(145deg, #e1a33d, #c87c12); }
.btn.small { padding: 7px 9px; font-size: 12px; border-radius: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--muted); font-weight: 800; font-size: 12px; }
.input, .select, .textarea {
  width: 100%; min-width: 0; border: 1px solid rgba(255,255,255,.8); outline: 0; border-radius: 14px;
  color: var(--text); background: #f5faff; box-shadow: var(--inset); padding: 11px 12px;
}
.textarea { min-height: 88px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; align-items: end; }

.table-wrap { overflow: auto; border-radius: 16px; box-shadow: var(--inset); background: rgba(238,247,254,.65); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(83,113,146,.13); vertical-align: top; font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 950; }
tr:last-child td { border-bottom: 0; }
.cell-title { font-weight: 900; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 950; background: #eaf3ff; color: #3376c7; }
.badge.ok { color: #07805b; background: #dcf6ee; }
.badge.warn { color: #96610d; background: #fff1d6; }
.badge.danger { color: #b52f43; background: #ffe2e8; }
.muted { color: var(--muted); }
.empty, .error-box {
  padding: 18px; border-radius: 18px; background: rgba(247,251,255,.75); box-shadow: var(--inset); color: var(--muted);
}
.error-box { color: #a33145; background: #fff0f3; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { border: 0; border-radius: 999px; padding: 9px 12px; color: #40506a; background: #f5faff; font-weight: 900; box-shadow: var(--inset); }
.tab.active { color: white; background: linear-gradient(145deg, var(--blue), #65aaff); box-shadow: 0 10px 20px rgba(63,140,255,.22); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card { width: min(940px, 100%); display: grid; grid-template-columns: .95fr 1.05fr; gap: 22px; }
.login-hero { border-radius: 28px; padding: 28px; background: rgba(247,251,255,.74); box-shadow: var(--shadow); }
.login-hero h1 { margin: 18px 0 8px; font-size: 38px; }
.login-hero p { color: var(--muted); line-height: 1.6; }
.mini-chart { height: 150px; display: flex; align-items: end; gap: 14px; padding: 16px; margin-top: 24px; border-radius: 22px; box-shadow: var(--inset); }
.bar { flex: 1; border-radius: 16px 16px 8px 8px; background: linear-gradient(180deg, #8cc8ff, #f6fbff); min-height: 28px; box-shadow: 0 10px 18px rgba(63,140,255,.15); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast-item { padding: 12px 14px; border-radius: 14px; background: #f7fbff; box-shadow: var(--shadow); font-weight: 850; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(18,32,53,.35); display: grid; place-items: center; z-index: 40; padding: 22px; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 44px); overflow: auto; }

@media (max-width: 1040px) {
  .admin-shell { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; height: auto; }
  .nav-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
  .nav-label { grid-column: 1 / -1; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .login-card, .form-row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .toolbar { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .nav-group { grid-template-columns: 1fr; }
  .title h1 { font-size: 21px; }
  .card { padding: 14px; border-radius: 17px; }
  .btn { width: 100%; }
  .actions .btn { width: auto; }
}

.restaurant-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.restaurant-toolbar h2 { margin:0 0 4px; }
.restaurant-layout { display:grid; grid-template-columns:minmax(0, 1fr) 360px; gap:16px; align-items:start; }
.restaurant-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:16px; }
.restaurant-card { border:1px solid rgba(255,255,255,.72); border-radius:22px; overflow:hidden; background:rgba(247,251,255,.78); box-shadow:var(--shadow); cursor:pointer; min-width:0; }
.restaurant-card:hover, .restaurant-card.selected { outline:2px solid rgba(63,140,255,.32); transform:translateY(-1px); }
.restaurant-cover { height:124px; background:#eaf4ff; box-shadow:var(--inset); overflow:hidden; }
.restaurant-cover img { width:100%; height:100%; object-fit:cover; display:block; }
.cover-fallback { width:100%; height:100%; background:linear-gradient(135deg,#dceeff,#ffffff 45%,#d5e8f7); }
.restaurant-body { display:grid; grid-template-columns:54px minmax(0,1fr) auto; gap:12px; align-items:center; padding:14px 14px 8px; }
.restaurant-logo { width:54px; height:54px; border-radius:18px; display:grid; place-items:center; background:#f7fbff; box-shadow:var(--inset); color:var(--blue); font-weight:950; overflow:hidden; }
.restaurant-logo img { width:100%; height:100%; object-fit:cover; }
.restaurant-main { min-width:0; }
.restaurant-main h3 { margin:0; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.restaurant-main p { margin:4px 0 0; color:var(--muted); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.restaurant-status { justify-self:end; }
.restaurant-meta { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; padding:0 14px 14px; color:var(--muted); font-size:12px; font-weight:800; }
.restaurant-detail { position:sticky; top:24px; }
.detail-list { display:grid; gap:10px; margin:12px 0; }
.detail-list div { padding:11px; border-radius:14px; box-shadow:var(--inset); background:rgba(241,248,254,.72); }
.detail-list span { display:block; color:var(--muted); font-size:11px; font-weight:900; text-transform:uppercase; letter-spacing:.06em; margin-bottom:4px; }
.detail-list strong { display:block; font-size:13px; word-break:break-word; }
.payment-panel { margin-top:12px; padding:13px; border-radius:16px; background:#f5faff; box-shadow:var(--inset); }
.payment-panel h3 { margin:0 0 6px; }
.detail-actions { margin-top:14px; }
.permission-grid { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:9px; }
.check { display:flex; align-items:center; gap:8px; padding:10px 11px; border-radius:14px; background:#f5faff; box-shadow:var(--inset); font-weight:850; color:#3e4c64; }
.check input { width:16px; height:16px; accent-color:var(--blue); }
.payment-methods { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.pay-method { border-radius:16px; padding:13px; box-shadow:var(--inset); background:#f5faff; }
.pay-method strong, .pay-method span { display:block; }
.pay-method span { color:var(--muted); font-size:12px; margin-top:4px; }
.pay-method.active { outline:2px solid rgba(63,140,255,.25); }
.pay-method.disabled { opacity:.58; }
.modal { width:min(960px,100%); }
.modal .form-row { grid-template-columns:repeat(3,minmax(0,1fr)); }

@media (max-width: 1180px) {
  .restaurant-layout { grid-template-columns:1fr; }
  .restaurant-detail { position:static; }
}
@media (max-width: 760px) {
  .restaurant-toolbar { align-items:flex-start; flex-direction:column; }
  .restaurant-grid, .payment-methods, .permission-grid, .modal .form-row { grid-template-columns:1fr; }
  .restaurant-body { grid-template-columns:48px minmax(0,1fr); }
  .restaurant-status { grid-column:1 / -1; justify-self:start; }
  .restaurant-meta { grid-template-columns:1fr; }
}

.restaurant-pay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}
.restaurant-pay-actions .btn {
  width: 100%;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
}
@media (max-width: 560px) {
  .restaurant-pay-actions { grid-template-columns: 1fr; }
}

.media-cell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 260px;
}
.media-thumb {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  background: #eaf4ff;
  box-shadow: var(--inset);
  display: block;
}
.empty-thumb {
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
}
.media-copy { min-width: 0; }
.media-copy .cell-title,
.media-copy .cell-sub {
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-copy .cell-sub {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
@media (max-width: 560px) {
  .media-cell { grid-template-columns: 52px minmax(0, 1fr); min-width: 220px; }
  .media-thumb { width: 52px; height: 52px; border-radius: 14px; }
}
