/* Global reset, shell/layout and shared compatibility bases. */
:root{--bg:#f6f7f9;--card:#fff;--text:#111827;--muted:#6b7280;--line:#e5e7eb;--navy:#111827;--accent:#0f766e;--danger:#b91c1c}
*{box-sizing:border-box}
html{margin:0;background:var(--bg);color:var(--text);font-family:var(--ui-font-family)}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--ui-font-family)}
button{font:inherit}
input{font:inherit}
select{font:inherit}
textarea{font:inherit}
.hidden{display:none!important}
.safe-bottom{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
.lang{padding:3px}
.lang button{padding:7px 10px;color:#6b7280}
.lang button.active{background:#111827;color:#fff}
label{font-size:12px;display:block;margin:12px 0 6px}
input{width:100%;padding:13px;border:1px solid #d1d5db;border-radius:12px;background:#fff}
select{padding:13px}
textarea{padding:13px}
.primary{width:100%;padding:14px;margin-top:16px}
.hint{font-size:12px;color:#6b7280;background:#f9fafb;border:1px solid #e5e7eb;border-radius:12px;padding:10px;margin-top:12px}
.error{color:#b91c1c;font-size:12px;margin-top:10px}
.password-field-wrap{position:relative;width:100%}
.password-field-wrap>input{padding-right:52px!important}
.password-toggle{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:42px;height:42px;background:transparent;color:#64748b;cursor:pointer}
.password-toggle:active{background:#f1f5f9}
.password-toggle svg{width:23px;height:23px;pointer-events:none}
@media(max-width:640px){.password-toggle{width:46px;height:46px;right:5px}}
.app-header{position:sticky;top:0;z-index:20;background:#111827;color:#fff;padding:calc(10px + env(safe-area-inset-top)) 14px 10px}
.header-row{display:flex;align-items:center;gap:10px}
.logout{padding:8px 10px}
.header-title{font-weight:850;font-size:17px}
.header-row .spacer{flex:1}
.header-row .lang{background:#263244}
.header-row .lang button{color:#cbd5e1}
.header-row .lang button.active{background:#fff;color:#111827}
.top-menu-wrap{position:relative}
.top-menu-btn{padding:8px 11px;font-size:18px;line-height:1}
.top-menu{position:absolute;right:-40px;top:44px;min-width:190px;color:#111827;padding:6px;z-index:80}
.top-menu button,.top-menu a{width:100%;border:0;background:transparent;text-align:left;border-radius:10px;padding:11px 12px;font-weight:800;color:#111827;display:block;text-decoration:none;box-sizing:border-box}
.top-menu button:hover,.top-menu a:hover{background:#f3f4f6}
.top-menu-title{padding:8px 12px 5px;font-size:10px;font-weight:900;letter-spacing:.06em;color:#94a3b8;text-transform:uppercase}
.top-menu-sep{height:1px;background:#e5e7eb;margin:4px 6px}
main{padding:14px 14px 100px;max-width:760px;margin:auto}
.page-title{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:12px}
.page-title h2{font-size:24px;margin:0}
.page-title p{margin:4px 0 0;color:var(--muted);font-size:12px}
.cards2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.metric{border:1px solid var(--line);border-radius:16px;padding:14px}
.metric .n{font-size:26px;font-weight:900}
.metric .k{font-size:11px;color:var(--muted);margin-top:4px}
.section{border:1px solid var(--line);border-radius:18px;padding:14px;margin-top:12px}
.section h3{font-size:15px;margin:0 0 10px}
.alert{padding:10px;font-size:12px;margin:8px 0}
.filter-btn{width:auto;padding:0 12px}
/* Shared staff/payroll/payment presentation primitives. */
.ui-chip-inactive{background:#fee2e2;color:#991b1b}
.ui-chip-list{display:flex;gap:6px;flex-wrap:wrap;margin-top:5px}
.ui-chip-front{background:#e0f2fe;color:#075985}
.ui-chip-kitchen{background:#ecfdf5;color:#065f46}
.ui-chip-full-time{background:#ede9fe;color:#5b21b6}
.ui-chip-part-time{background:#fef3c7;color:#92400e}
.ui-info-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.ui-info .ui-info-label{font-size:10px;color:var(--muted)}
.ui-info .ui-info-value{font-size:13px;font-weight:750;margin-top:3px;overflow:hidden;text-overflow:ellipsis}

.chip{font-size:10px;padding:4px 7px;background:#f3f4f6}
.ui-info{padding:10px}
.add{position:fixed;right:16px;bottom:calc(82px + env(safe-area-inset-bottom));z-index:25;width:52px;height:52px;font-size:26px;box-shadow:0 8px 25px rgba(17,24,39,.3)}
.bottom-nav{position:fixed;left:0;right:0;bottom:0;z-index:30;background:rgba(255,255,255,.96);backdrop-filter:blur(14px);border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(5,1fr);padding:7px 6px calc(7px + env(safe-area-inset-bottom))}
.bottom-nav[data-visible-count="2"]{grid-template-columns:repeat(2,1fr)}
.bottom-nav[data-visible-count="4"]{grid-template-columns:repeat(4,1fr)}
.bottom-nav button{border:0;background:transparent;color:#6b7280;padding:4px;font-size:10px;font-weight:700}
.nav-ico{display:block;font-size:20px;line-height:22px;margin-bottom:2px}
.small-btn{border:1px solid #d1d5db;background:#fff}
.small-btn.primary-mini{border-color:#111827}
.role-note{font-size:11px;line-height:1.5}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.actions{display:flex;margin-top:16px}
.actions button{flex:1;border:0;border-radius:12px;padding:13px;font-weight:800}
.delete{border:1px solid #fecaca!important}
@media(max-width:640px){
  .header-title{font-size:15px}
  .header-row .lang button{padding:6px 8px}
  .form-grid{grid-template-columns:minmax(0,1fr);gap:12px;width:100%}
  .form-grid>div{min-width:0;width:100%}
  .form-grid input{display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box;font-size:16px;line-height:1.35}
  .form-grid select{display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box;font-size:16px;line-height:1.35}
  .form-grid textarea{display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box;font-size:16px;line-height:1.35}
  .form-grid textarea{min-height:88px;padding:14px 16px;resize:vertical;vertical-align:top}
  .form-grid input[type="date"]{width:100%;min-width:0;max-width:100%;-webkit-appearance:none;appearance:none}
  .actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .actions button{width:100%;min-width:0}
}

/* 1819 shared UI design system.
 * Canonical owner for reusable visual primitives.
 * Feature CSS should contain only feature-specific layout/behavior.
 */
:root{
  --ui-navy:#111827;
  --ui-header-control:#263244;
  --ui-muted:#64748b;
  --ui-line:#d1d5db;
  --ui-line-soft:#e5e7eb;
  --ui-surface:#fff;
  --ui-surface-soft:#f8fafc;
  --ui-surface-subtle:#f3f4f6;
  --ui-danger:#b91c1c;
  --ui-danger-line:#fecaca;
  --ui-warning-bg:#fff7ed;
  --ui-warning-line:#fed7aa;
  --ui-radius-sm:10px;
  --ui-radius-control:12px;
  --ui-radius-card:16px;
  --ui-radius-modal:18px;
  --ui-btn-h-sm:40px;
  --ui-btn-h-md:48px;
  --ui-btn-h-lg:58px;
  --ui-control-h:48px;
  --ui-font-control:16px;
  --ui-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;
  --ui-shadow-popover:0 12px 30px rgba(0,0,0,.16);
  --ui-shadow-modal:0 24px 70px rgba(0,0,0,.30);
}

/* Controls */
html body input:not([type="checkbox"]):not([type="radio"]),
html body select,
html body textarea,
html body .ui-control{
  box-sizing:border-box;
  width:100%;
  border:1px solid var(--ui-line);
  border-radius:var(--ui-radius-control);
  background:var(--ui-surface);
  color:var(--ui-navy);
}
html body textarea,html body .ui-textarea{line-height:1.4;vertical-align:top}
/* Empty readonly dates collapse in iPhone Safari without an explicit control height. */
html body .form-grid input:not([type="checkbox"]):not([type="radio"]),
html body .form-grid select{height:50px;min-height:50px}
html body label,html body .ui-label{color:var(--ui-muted)}

/* Button base + compatibility aliases */
html body .ui-btn,
html body .primary,
html body .small-btn,
html body .schedule-pdf-btn,
html body .payment-pdf-btn,
html body .payment-pdf-link,
html body .past-toggle,
html body .history-btn,
html body .announcement-add,
html body .announcement-cancel,
html body .announcement-save,
html body .filter-btn,
html body .save,
html body .delete{
  box-sizing:border-box;
  border-radius:var(--ui-radius-control);
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
}
html body button:disabled,html body .ui-btn:disabled{opacity:.55;cursor:not-allowed}

/* Button variants */
html body .ui-btn-primary,
html body .primary,
html body .small-btn.primary-mini,
html body .schedule-pdf-btn,
html body .payment-pdf-btn,
html body .announcement-add,
html body .announcement-save,
html body .save{
  border:1px solid var(--ui-navy);
  background:var(--ui-navy);
  color:#fff;
}
html body .ui-btn-secondary,
html body .small-btn:not(.primary-mini),
html body .payment-pdf-link,
html body .past-toggle,
html body .history-btn,
html body .announcement-cancel,
html body .filter-btn{
  border:1px solid var(--ui-line);
  background:var(--ui-surface);
  color:var(--ui-navy);
}
html body .ui-btn-danger,
html body .delete,
html body .announcement-delete,
html body .small-btn.announcement-delete{
  border:1px solid var(--ui-danger-line);
  background:var(--ui-surface);
  color:var(--ui-danger);
}
html body .ui-btn-block{width:100%}
html body .ui-btn-sm,html body .small-btn{min-height:var(--ui-btn-h-sm);padding:8px 10px;font-size:12px}
html body .ui-btn-md{min-height:var(--ui-btn-h-md);padding:12px 14px}
html body .ui-btn-lg{min-height:var(--ui-btn-h-lg);padding:0 18px;font-size:18px}

/* Header + icon buttons */
html body .ui-btn-icon,
html body .password-toggle,
html body .history-close,
html body .announcement-modal-close,
html body .sheet .sheet-head #closeSheet{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  border:0;
  border-radius:var(--ui-radius-sm);
}
html body .ui-header-btn,
html body .logout,
html body .top-menu-btn{
  box-sizing:border-box;
  border:0;
  border-radius:var(--ui-radius-sm);
  background:var(--ui-header-control);
  color:#fff;
}

/* Action rows */
html body .ui-actions,
html body .payment-actions,
html body .announcement-form-actions,
html body .actions{gap:8px}
html body .payment-actions>button,
html body .payment-actions>a{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:var(--ui-btn-h-md);
  border-radius:var(--ui-radius-control);
  font-weight:900;
  text-align:center;
}

/* Segmented controls */
html body .ui-segment,
html body .lang{
  box-sizing:border-box;
  display:flex;
  gap:3px;
  border-radius:var(--ui-radius-control);
  background:var(--ui-surface-subtle);
}
html body .ui-segment>button,
html body .lang>button{
  border:0;
  border-radius:9px;
  background:transparent;
  font-weight:800;
}

/* Surface/card primitives */
html body .ui-card,
html body .section,
html body .metric,
html body .staff-card,
html body .pay-card,
html body .pay-control-card,
html body .schedule-export,
html body .log-card,
html body .history-item,
html body .announcement-card,
html body .staff-filter-panel{
  box-sizing:border-box;
  border-color:var(--ui-line-soft);
  background:var(--ui-surface);
}
html body .ui-card{border:1px solid var(--ui-line-soft);border-radius:var(--ui-radius-card)}

/* Popover/menu surfaces */
html body .ui-popover,
html body .top-menu,
html body .staff-filter-menu,
html body .nav-hold-menu{
  box-sizing:border-box;
  border:1px solid var(--ui-line-soft);
  border-radius:14px;
  background:var(--ui-surface);
  box-shadow:var(--ui-shadow-popover);
}
html body .nav-hold-menu{position:fixed;z-index:350;bottom:calc(78px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(260px,88vw);padding:6px}
html body .nav-hold-menu button{width:100%;border:0;background:transparent;text-align:left;padding:12px;border-radius:10px;font-weight:800}
html body .nav-hold-menu button:active{background:var(--ui-surface-subtle)}
html body .bottom-nav[data-visible-count="3"]{grid-template-columns:repeat(3,1fr)}

/* Chips / badges */
html body .ui-chip,
html body .chip,
html body .announcement-badge,
html body .today-badge,
html body .off-badge,
html body .log-action{
  display:inline-flex;
  align-items:center;
  width:auto;
  border-radius:999px;
  font-weight:800;
}
html body .ui-count-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:52px;
  min-height:36px;
  padding:7px 12px;
  border:1px solid var(--ui-line-soft);
  border-radius:999px;
  background:var(--ui-surface);
  color:var(--ui-navy);
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
}

/* Modal primitives */
html body .ui-modal-backdrop,
html body .history-modal-backdrop,
html body .announcement-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.48);
}
html body .ui-modal,
html body .history-modal,
html body .announcement-modal{
  box-sizing:border-box;
  background:var(--ui-surface);
  border-radius:var(--ui-radius-modal);
}
html body .ui-modal{box-shadow:var(--ui-shadow-modal)}
html body .ui-modal-header,
html body .history-modal-head,
html body .announcement-modal-header{
  display:flex;
  align-items:center;
  gap:10px;
  border-bottom:1px solid var(--ui-line-soft);
  background:var(--ui-surface);
}

/* Floating action button */
html body .ui-fab,
html body .add{
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:50%;
  background:var(--ui-navy);
  color:#fff;
}

/* Shared feedback / information */
html body .ui-warning,
html body .alert{
  box-sizing:border-box;
  border:1px solid var(--ui-warning-line);
  border-radius:var(--ui-radius-control);
  background:var(--ui-warning-bg);
}
html body .ui-info-tile,
html body .ui-info,
html body .history-change{
  box-sizing:border-box;
  border-radius:var(--ui-radius-control);
  background:var(--ui-surface-soft);
}

/* Shared text helpers */
html body .ui-muted,html body .role-note{color:var(--ui-muted)}
html body .ui-total,html body .total-box{background:var(--ui-surface-soft);font-weight:900}

/* Bottom navigation icon normalization */
html body .bottom-nav button{display:flex;min-width:0;flex-direction:column;align-items:center;justify-content:center}
html body .bottom-nav .nav-ico{display:flex;width:24px;height:24px;min-height:24px;align-items:center;justify-content:center;margin:0 auto 3px;font-size:22px;line-height:1;font-weight:800}
html body .bottom-nav button[data-page="dashboard"] .nav-ico{color:#2563eb}
html body .bottom-nav button[data-page="reservations"] .nav-ico{color:#0f766e}
html body .bottom-nav button[data-page="schedule"] .nav-ico{color:#7c3aed}
html body .bottom-nav button[data-page="staff"] .nav-ico{color:#0ea5e9;font-size:21px}
html body .bottom-nav button[data-page="payments"] .nav-ico{color:#059669}
html body .bottom-nav button.active{color:var(--ui-navy)}

@media(max-width:640px){
  html body input:not([type="checkbox"]):not([type="radio"]),
  html body select,
  html body textarea{font-size:16px}
  html body .ui-btn-lg{min-height:var(--ui-btn-h-lg)}
  html body .ui-count-badge{min-width:48px;min-height:34px;padding:6px 10px;font-size:12px}
  html body .bottom-nav button{min-width:0}
  html body .bottom-nav .nav-ico{width:24px;height:24px;min-height:24px;font-size:22px}
  html body .bottom-nav button[data-page="staff"] .nav-ico{font-size:21px}
}


/* Keep responsive component sizes; normalize family and prevent Safari text inflation. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
button,input,select,textarea,legend,code,pre{font-family:inherit}
