/* ==========================================================================
   RK Cooking Center — Admin & Staff portal shell
   Shares brand tokens with style.css; loaded in addition to it.
   ========================================================================== */

body.portal { background: var(--surface-alt); }

.portal-shell { display: flex; min-height: 100vh; }

.portal-sidebar {
  width: 252px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--purple-950), var(--purple-800));
  color: rgba(255,255,255,0.85);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.portal-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; color: #fff; font-weight: 800; font-size: 16px; }
.portal-brand .brand-mark { background: #fff; box-shadow: none; }
.portal-nav { display: grid; gap: 3px; }
.portal-nav-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.4); padding: 16px 12px 6px; }
.portal-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px; font-weight: 600; font-size: 14px;
  color: rgba(255,255,255,0.75);
  transition: background 0.15s ease, color 0.15s ease;
}
.portal-nav a .icon { width: 18px; height: 18px; flex-shrink: 0; }
.portal-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.portal-nav a.active { background: #fff; color: var(--purple-800); }
.portal-nav-badge { margin-left: auto; background: var(--green-500); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }

.portal-main { flex: 1; min-width: 0; }
.portal-topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: #fff; border-bottom: 1px solid var(--surface-line);
  position: sticky; top: 0; z-index: 20;
}
.portal-topbar h1 { font-size: 19px; }
.portal-topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-600), var(--green-500));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.topbar-user .meta strong { display: block; font-size: 13.5px; }
.topbar-user .meta span { font-size: 12px; color: var(--ink-500); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--surface-line); background: #fff; display: flex; align-items: center; justify-content: center; position: relative; }
.icon-btn .icon { width: 18px; height: 18px; color: var(--ink-700); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--red-500); }

.portal-mobile-toggle { display: none; }
@media (max-width: 980px) {
  .portal-sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 90; transition: left 0.2s ease; }
  .portal-sidebar.open { left: 0; }
  .portal-mobile-toggle { display: inline-flex; }
  .portal-scrim { display: none; position: fixed; inset: 0; background: rgba(20,10,35,0.4); z-index: 80; }
  .portal-scrim.open { display: block; }
}

.portal-body { padding: 26px 28px 60px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 26px; }
.kpi-card { background: #fff; border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 20px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.kpi-icon .icon { width: 20px; height: 20px; }
.kpi-icon.purple { background: var(--purple-100); color: var(--purple-700); }
.kpi-icon.green { background: var(--green-100); color: var(--green-700); }
.kpi-icon.amber { background: var(--amber-100); color: var(--amber-500); }
.kpi-icon.blue { background: var(--blue-100); color: var(--blue-500); }
.kpi-trend { font-size: 12px; font-weight: 700; color: var(--green-600); }
.kpi-card strong { display: block; font-size: 26px; font-weight: 800; }
.kpi-card span { font-size: 13px; color: var(--ink-500); font-weight: 600; }

.panel { background: #fff; border: 1px solid var(--surface-line); border-radius: var(--radius-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--surface-line); gap: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; }
.panel-body { padding: 22px; }
.panel + .panel { margin-top: 20px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-500); padding: 12px 22px; border-bottom: 1px solid var(--surface-line); white-space: nowrap; }
.data-table td { padding: 14px 22px; border-bottom: 1px solid var(--surface-line); font-size: 14px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-alt); }
.data-table .icon { width: 14px; height: 14px; vertical-align: -2px; color: var(--amber-500); }
.svc-name { display: flex; align-items: center; gap: 10px; }
.svc-name .icon-wrap { border-radius: 9px; background: var(--purple-100); color: var(--purple-700); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.svc-name .icon-wrap .icon { width: 16px; height: 16px; color: var(--purple-700); }
.table-wrap { overflow-x: auto; }
.row-avatar { display: flex; align-items: center; gap: 10px; }
.row-avatar .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--purple-600), var(--green-500)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.row-avatar strong { display: block; font-size: 13.5px; }
.row-avatar span { font-size: 12px; color: var(--ink-500); }
.table-actions { display: flex; gap: 6px; }
.table-actions .icon-btn { width: 32px; height: 32px; border-radius: 8px; }
.table-actions .icon-btn .icon { width: 15px; height: 15px; }
.empty-row td { text-align: center; padding: 40px 20px; color: var(--ink-500); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { padding: 10px 13px; border-radius: 10px; border: 1.5px solid var(--surface-line); font-size: 13.5px; background: #fff; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--purple-500); }

.tab-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-strip a, .tab-strip button {
  padding: 8px 15px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700;
  border: 1.5px solid var(--surface-line); background: #fff; color: var(--ink-700);
}
.tab-strip a.active, .tab-strip button.active { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }

.stat-mini-list { display: grid; gap: 14px; }
.stat-mini-row { display: flex; align-items: center; justify-content: space-between; }
.stat-mini-row .label { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.stat-mini-row .dot { width: 9px; height: 9px; border-radius: 50%; }
.progress-track { height: 8px; border-radius: 999px; background: var(--gray-100); overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--purple-600), var(--green-500)); }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--purple-950), var(--purple-700) 60%, var(--green-700)); padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius-lg); padding: 40px 34px; box-shadow: var(--shadow-lg); }
.login-card .portal-brand { color: var(--ink-900); padding: 0 0 26px; justify-content: center; }
.login-card .portal-brand .brand-mark { background: #fff; border: 1px solid var(--surface-line); color: #fff; }
.login-card h1 { font-size: 20px; text-align: center; }
.login-card p.sub { text-align: center; color: var(--ink-500); font-size: 13.5px; margin-top: 6px; margin-bottom: 26px; }
.login-form { display: grid; gap: 16px; }

.job-card { border: 1px solid var(--surface-line); border-radius: var(--radius-md); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.job-card + .job-card { margin-top: 12px; }
.job-card .job-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--purple-100); color: var(--purple-700); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.job-card .job-icon .icon { width: 21px; height: 21px; }
.job-meta strong { display: block; font-size: 14.5px; }
.job-meta span { font-size: 12.5px; color: var(--ink-500); }
.job-actions { display: flex; gap: 8px; }

/* Logout is a POST form, styled to sit with the nav links */
.portal-logout-form { margin: 0; }
.portal-logout {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px; font-weight: 600; font-size: 14px;
  color: rgba(255,255,255,0.75); background: transparent; border: none; text-align: left;
  font-family: inherit; cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.portal-logout .icon { width: 18px; height: 18px; flex-shrink: 0; }
.portal-logout:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Security center */
.sec-list { display: grid; gap: 10px; }
.sec-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; background: var(--surface-alt); }
.sec-item strong { display: block; font-size: 13.5px; }
.sec-item small { display: block; font-size: 12px; color: var(--ink-500); margin-top: 1px; }
.sec-dot { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sec-dot .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.sec-item.pass .sec-dot { background: var(--green-100); color: var(--green-700); }
.sec-item.fail .sec-dot { background: var(--red-100); color: var(--red-500); }
.qr-box { width: 190px; max-width: 100%; margin: 12px 0; padding: 8px; background: #fff; border: 1px solid var(--surface-line); border-radius: 12px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.secret-key { display: inline-block; margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--purple-50); color: var(--purple-800); font-weight: 700; letter-spacing: .08em; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery-grid code { padding: 9px 10px; text-align: center; border-radius: 8px; background: var(--purple-50); color: var(--purple-800); font-weight: 700; letter-spacing: .06em; }

/* ---- Booking console additions ---- */
.cancel-req { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--surface-line); }
.check-inline { display: flex !important; align-items: center; gap: 8px; font-weight: 600 !important; font-size: 13px !important; color: var(--ink-500) !important; }
.check-inline input { width: auto; }
.filter-wide { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 16px; }
.filter-wide input, .filter-wide select { min-width: 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 18px; border-top: 1px solid var(--surface-line); }
.coupon-chip { display: inline-block; padding: 4px 10px; border-radius: 8px; background: var(--purple-100); color: var(--purple-800); letter-spacing: .06em; font-size: 12.5px; }

/* ---- Charts ---- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #ece8f5; stroke-width: 1; }
.chart .axis { fill: #8a85a0; font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--purple-600, #6d3fc4); transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart .line { fill: none; stroke: var(--purple-700, #55279f); stroke-width: 2.5; stroke-linecap: round; }
.chart .dot { fill: #fff; stroke: var(--purple-700, #55279f); stroke-width: 2; }
.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut-n { font-size: 24px; font-weight: 800; fill: var(--ink-900, #1d1a2b); font-family: inherit; }
.donut-l { font-size: 10px; fill: #8a85a0; font-family: inherit; text-transform: uppercase; letter-spacing: .08em; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 13.5px; flex: 1; min-width: 150px; }
.legend li { display: flex; align-items: center; gap: 9px; }
.legend i { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }
.legend b { margin-left: auto; }
.attn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.attn-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: var(--ink-900); text-decoration: none; font-size: 14px; font-weight: 600; transition: background .15s; }
.attn-list a:hover { background: var(--purple-50, #f6f2fd); }
.attn-list .n { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-weight: 800; font-size: 13px; background: var(--amber-100, #fef3c7); color: #b45309; }
.attn-list .n.ok { background: var(--green-100); color: var(--green-700); }
.attn-list .n.red { background: var(--red-100); color: var(--red-500); }
.kpi-delta { font-size: 12px; font-weight: 700; margin-left: 6px; }
.kpi-delta.up { color: var(--green-700); }
.kpi-delta.down { color: var(--red-500); }

/* ---- Calendar ---- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--surface-line); border-top: 1px solid var(--surface-line); }
.cal-h { background: var(--purple-50, #f6f2fd); padding: 10px 6px; text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-500); text-transform: uppercase; letter-spacing: .06em; }
.cal-c { background: #fff; min-height: 84px; padding: 9px 10px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-900); text-decoration: none; transition: background .15s; position: relative; }
.cal-c.empty { background: #faf9fd; }
a.cal-c:hover { background: var(--purple-50, #f6f2fd); }
.cal-c.today .cal-d { background: var(--purple-700); color: #fff; }
.cal-c.sel { box-shadow: inset 0 0 0 2px var(--purple-500); }
.cal-d { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.cal-n { position: absolute; top: 9px; right: 10px; font-size: 12px; font-weight: 800; color: var(--purple-700); }
.cal-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-dots i { width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 640px) { .cal-c { min-height: 58px; padding: 6px; } .cal-h { font-size: 10px; padding: 8px 2px; } }

/* ---- System health ---- */
.health { list-style: none; margin: 0; padding: 0; display: grid; }
.health li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--surface-line); font-size: 14px; }
.health li:last-child { border: 0; }
.health .dotm { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.health .dotm .icon { width: 14px; height: 14px; }
.health li.good .dotm { background: var(--green-100); color: var(--green-700); }
.health li.warn .dotm { background: var(--amber-100, #fef3c7); color: #b45309; }
.health em { margin-left: auto; font-style: normal; color: var(--ink-500); text-align: right; font-size: 13px; }

/* ---- Topbar search + notifications ---- */
.topbar-search { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 40px; border-radius: 999px; background: #fff; border: 1.5px solid var(--surface-line); min-width: 240px; transition: border-color .15s, box-shadow .15s; }
.topbar-search:focus-within { border-color: var(--purple-500); box-shadow: 0 0 0 4px var(--purple-100); }
.topbar-search .icon { width: 17px; height: 17px; color: var(--ink-500); flex-shrink: 0; }
.topbar-search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 13.5px; width: 100%; }
.notif { position: relative; }
.notif summary { list-style: none; cursor: pointer; position: relative; }
.notif summary::-webkit-details-marker { display: none; }
.notif-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red-500, #ef4444); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.notif-menu { position: absolute; right: 0; top: 48px; width: 290px; background: #fff; border: 1px solid var(--surface-line); border-radius: 16px; box-shadow: 0 20px 50px rgba(50,30,100,.18); padding: 12px; z-index: 60; display: grid; gap: 2px; }
.notif-menu > strong { padding: 6px 10px 10px; font-size: 14px; }
.notif-menu a { display: flex; gap: 10px; padding: 10px; border-radius: 10px; color: var(--ink-900); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.notif-menu a:hover { background: var(--purple-50, #f6f2fd); }
.notif-menu a b { min-width: 24px; height: 24px; border-radius: 8px; background: var(--purple-100); color: var(--purple-800); display: grid; place-items: center; font-size: 12px; }
.notif-menu p { padding: 6px 10px 10px; margin: 0; font-size: 13.5px; }
@media (max-width: 900px) { .topbar-search { display: none; } }

/* ---- Staff attendance punch card ---- */
.punch-body { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.punch-times { display: flex; gap: 34px; }
.punch-times span { display: block; font-size: 12px; font-weight: 700; color: var(--ink-500); text-transform: uppercase; letter-spacing: .06em; }
.punch-times strong { font-size: 22px; }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; } }

/* ---- Small-screen hardening ---- */
.two-col > *, .portal-main, .portal-body, .panel { min-width: 0; }
.two-col { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.portal-topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 640px) {
  .portal-topbar { gap: 10px; }
  .portal-topbar-right { gap: 8px; }
  .topbar-user .meta { display: none; }
  .portal-topbar-right > a.icon-btn { display: none; }
  .portal-topbar h1 { font-size: 16px; }
  .panel-head { padding: 16px; }
}

/* ---- Staff verification panel ---- */
.verify-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.verify-grid h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); margin-bottom: 8px; }
.verify-ref code { background: var(--purple-50, #f6f2fd); color: var(--purple-800); padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.verify-photo { width: 90px; height: 90px; border-radius: 12px; object-fit: cover; border: 1px solid var(--surface-line); }
@media (max-width: 900px) { .verify-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Staff SOS ---- */
.sos-fab { position: fixed; bottom: 22px; right: 22px; z-index: 70; display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-radius: 999px; border: none; background: var(--red-500, #ef4444); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 14px 30px rgba(239,68,68,.45); cursor: pointer; }
.sos-fab .icon { width: 18px; height: 18px; }
.sos-fab:hover { transform: translateY(-1px); }
.sos-modal { position: fixed; inset: 0; z-index: 80; background: rgba(20,10,30,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.sos-modal-card { background: #fff; border-radius: 20px; padding: 28px; max-width: 380px; width: 100%; text-align: center; position: relative; }
.sos-modal-card h3 { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--red-500); font-size: 19px; margin-bottom: 10px; }
.sos-modal-card h3 .icon { width: 22px; height: 22px; }
.sos-modal-card p.muted { font-size: 13px; margin-bottom: 18px; }
.sos-modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; cursor: pointer; color: var(--ink-500); }
.sos-modal-close .icon { width: 18px; height: 18px; }
.sos-pulse { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; background: var(--red-500); position: relative; }
.sos-pulse::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--red-500); animation: rk-sos-pulse 1.4s ease-out infinite; }
@keyframes rk-sos-pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.2); opacity: 0; } }
.sos-status { font-weight: 700; font-size: 14px; }
.sos-status.ok { color: var(--green-700); display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 10px; }
.sos-error { color: var(--red-500); font-size: 13px; font-weight: 600; margin-top: 10px; }
.sos-row-open { background: #fef2f2; }
