/* ==========================================================================
   HotelOS PMS — Design tokens
   Palette: deep ink navy rail, warm brass accent (concierge-bell reference),
   cool neutral workspace. Built for data density & long shifts, not marketing.
   ========================================================================== */
:root {
  --ink-900: #232A33;
  --ink-800: #2E3743;
  --ink-700: #48505B;
  --brass: #5DA9EA;
  --brass-dark: #3D82C4;
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --border: #E3E7EE;
  --text: #1B2333;
  --text-muted: #647087;
  --text-faint: #9AA5B8;
  --success: #17825A;
  --success-bg: #E5F6EE;
  --warning: #B4700C;
  --warning-bg: #FDF1DC;
  --danger: #C4342F;
  --danger-bg: #FBEAE9;
  --info: #2A5DB0;
  --info-bg: #E9F0FC;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(35, 42, 51, 0.07);
  --shadow-md: 0 8px 24px rgba(35, 42, 51, 0.12);
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
table { border-collapse: collapse; width: 100%; }
button { font-family: inherit; }

/* ---------------- App shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------------- Left module rail ---------------- */
.module-rail {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-800) 100%);
  color: #DCE3F0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-logo-img {
  width: 100%; max-width: 190px; height: auto;
  background: #fff; border-radius: 10px; padding: 8px 10px;
  box-shadow: var(--shadow-sm);
}

.module-list { flex: 1; overflow-y: auto; padding: 10px 10px; }
.module-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin-bottom: 2px;
  border-radius: 8px;
  color: #AFBBD1;
  font-size: 13.3px; font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.module-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.module-item.active {
  background: rgba(93, 169, 234, 0.16);
  color: #BFE0FA;
  box-shadow: inset 3px 0 0 var(--brass);
}
.module-icon {
  width: 17px; height: 17px; flex-shrink: 0;
  border-radius: 4px;
  background: currentColor;
  opacity: 0.85;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  display: inline-block;
}
/* simple geometric glyphs per icon key using mask shapes via unicode-ish blocks */
.icon-grid { -webkit-mask-image: none; background: currentColor; border-radius: 4px; opacity:.9; clip-path: polygon(0 0,45% 0,45% 45%,0 45%,0 0,55% 0,55% 45%,100% 45%,100% 0,55% 0,0 0,0 55%,45% 55%,45% 100%,0 100%,0 55%,55% 55%,55% 100%,100% 100%,100% 55%,55% 55%); }
.icon-key { clip-path: circle(30% at 30% 50%); }
.icon-users { clip-path: polygon(20% 100%,20% 60%,50% 40%,80% 60%,80% 100%); border-radius: 50% 50% 4px 4px; }
.icon-broom { clip-path: polygon(45% 0,55% 0,60% 70%,100% 100%,0 100%,40% 70%); }
.icon-wrench { clip-path: polygon(0 100%,40% 60%,55% 75%,15% 100%); border-radius: 3px; }
.icon-cup { clip-path: polygon(15% 20%,85% 20%,75% 100%,25% 100%); }
.icon-globe { border-radius: 50%; }
.icon-chart { clip-path: polygon(0 100%,0 60%,25% 60%,25% 100%,35% 100%,35% 30%,55% 30%,55% 100%,65% 100%,65% 50%,85% 50%,85% 100%); }
.icon-star { clip-path: polygon(50% 0%,63% 35%,100% 38%,72% 60%,82% 95%,50% 75%,18% 95%,28% 60%,0% 38%,37% 35%); }
.icon-chat { border-radius: 6px 6px 6px 2px; }
.icon-bar { clip-path: polygon(0 40%,30% 40%,30% 100%,0 100%,35% 20%,65% 20%,65% 100%,35% 100%,70% 0,100% 0,100% 100%,70% 100%); }
.icon-gear { border-radius: 50%; clip-path: polygon(50% 0,61% 10%,75% 5%,80% 20%,95% 25%,90% 40%,100% 50%,90% 60%,95% 75%,80% 80%,75% 95%,61% 90%,50% 100%,39% 90%,25% 95%,20% 80%,5% 75%,10% 60%,0 50%,10% 40%,5% 25%,20% 20%,25% 5%,39% 10%); }
.icon-logout { clip-path: polygon(0 30%,45% 30%,45% 0,100% 50%,45% 100%,45% 70%,0 70%); }
.icon-calendar { clip-path: polygon(0 15%,100% 15%,100% 100%,0 100%,0 15%,15% 15%,15% 0,25% 0,25% 15%,75% 15%,75% 0,85% 0,85% 15%); border-radius: 2px; }
.icon-drop { clip-path: polygon(50% 0%,85% 55%,85% 55%,50% 100%,15% 55%); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.icon-inbox { clip-path: polygon(0 0,100% 0,100% 100%,0 100%,0 60%,30% 60%,40% 80%,60% 80%,70% 60%,100% 60%); }
.icon-roster { clip-path: polygon(0 5%,100% 5%,100% 25%,0 25%,0 5%,0 40%,100% 40%,100% 60%,0 60%,0 40%,0 75%,100% 75%,100% 95%,0 95%,0 75%); }

.rail-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.module-item.logout:hover { color: #F2A3A0; }

/* ---------------- Main area ---------------- */
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top-header {
  height: 60px; flex-shrink: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.top-header-left { min-width: 0; }
.module-title { font-size: 19px; color: var(--ink-900); }
.top-header-center {
  justify-self: center; text-align: center; white-space: nowrap;
  font-size: 13px; color: var(--text-muted); letter-spacing: 0.2px;
}
.top-header-center .clock-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-900); margin-left: 8px; }
.top-header-right { justify-self: end; display: flex; align-items: center; gap: 14px; }
.property-logo-img { height: 28px; width: auto; border-radius: 4px; object-fit: contain; }
.property-name { font-size: 12.5px; color: var(--text-muted); }
.property-switcher {
  font-size: 12.5px; color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; max-width: 220px;
}
.user-chip {
  background: var(--ink-900); color: #fff;
  padding: 5px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sub-nav {
  display: flex; align-items: center; gap: 4px;
  padding: 0 22px; height: 46px; flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.sub-nav-item {
  padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--text-muted);
  border-radius: 7px 7px 0 0; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.sub-nav-item:hover { color: var(--ink-900); background: var(--bg); }
.sub-nav-item.active { color: var(--brass-dark); border-bottom-color: var(--brass); }

.content-area { flex: 1; padding: 22px 26px 60px 26px; max-width: 1500px; width: 100%; }

/* ---------------- Flash messages ---------------- */
.flash-stack { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-warning { background: var(--warning-bg); color: var(--warning); }
.flash-info { background: var(--info-bg); color: var(--info); }

/* ---------------- Cards / Panels ---------------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 18px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 15px; font-weight: 700; color: var(--ink-900); }
.panel-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--brass);
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 26px; font-weight: 750; color: var(--ink-900); margin-top: 4px; }
.kpi-note { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ---------------- Tables ---------------- */
.data-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table table { width: 100%; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 700; padding: 11px 14px; background: #FAFBFD;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.3px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FBFBFD; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--text-faint); }
.empty-state strong { display:block; color: var(--text-muted); font-size: 14px; margin-bottom: 4px;}

/* ---------------- Badges / status pills ---------------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.01em; }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-amber { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-gray { background: #EEF0F4; color: var(--text-muted); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content:center;
  padding: 8px 15px; border-radius: 8px; font-size: 13px; font-weight: 650;
  border: 1px solid transparent; cursor: pointer; transition: all 0.12s ease;
}
.btn-primary { background: var(--ink-900); color: #fff; }
.btn-primary:hover { background: var(--ink-700); }
.btn-brass { background: var(--brass); color: var(--ink-900); }
.btn-brass:hover { background: var(--brass-dark); color: #fff; }
.btn-outline { background: var(--surface); color: var(--ink-900); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.actions-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items:center; }
.spacer { flex: 1; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12.3px; font-weight: 650; color: var(--text); }
.form-field .hint { font-size: 11.5px; color: var(--text-faint); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=tel], input[type=search], select, textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(93,169,234,0.18); }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 16px; height: 16px; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(35, 42, 51, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-backdrop.hidden { display: none; }
.modal-box { background: var(--surface); border-radius: var(--radius-lg); width: 440px; max-width: 92vw; max-height: 88vh; box-shadow: var(--shadow-md); overflow: hidden; display: flex; flex-direction: column; }
.modal-box.wide { width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 15px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-faint); cursor: pointer; line-height:1; }
.modal-body { padding: 18px; font-size: 13.5px; color: var(--text); overflow-y: auto; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* Warning-flavored modal */
.modal-box.warn .modal-header { background: var(--warning-bg); }
.modal-box.warn #global-modal-title { color: var(--warning); }

/* ---------------- Login page ---------------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--ink-700), var(--ink-900) 60%);
}
.login-card {
  background: var(--surface); width: 380px; padding: 34px 30px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.login-brand { display:flex; align-items:center; justify-content:center; margin-bottom: 22px; }
.login-card .form-field { margin-bottom: 14px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--text-faint); text-align: center; }

/* ---------------- Room / KOT board ---------------- */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.room-tile {
  border-radius: 10px; padding: 12px; border: 1px solid var(--border); background: var(--surface);
  display:flex; flex-direction: column; gap: 6px;
}
.room-tile .room-no { font-weight: 750; font-size: 15px; color: var(--ink-900); }
.room-tile .room-type { font-size: 11.5px; color: var(--text-muted); }
.room-tile.status-VACANT_CLEAN { border-left: 4px solid var(--success); }
.room-tile.status-VACANT_DIRTY { border-left: 4px solid var(--warning); }
.room-tile.status-OCCUPIED { border-left: 4px solid var(--info); }
.room-tile.status-OOO, .room-tile.status-OOS { border-left: 4px solid var(--danger); opacity: 0.8; }

/* ---------------- POS ---------------- */
.pos-layout { display: grid; grid-template-columns: 2.2fr 1fr; gap: 18px; align-items:start; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.menu-item-tile { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); cursor: pointer; transition: border-color .12s; }
.menu-item-tile:hover { border-color: var(--brass); }
.menu-item-tile .name { font-weight: 650; font-size: 13px; }
.menu-item-tile .price { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }
.cart-line { display:flex; justify-content:space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.cart-total-row { display:flex; justify-content:space-between; padding: 10px 0; font-weight: 700; font-size: 14.5px; }

/* ---------------- Misc ---------------- */
.muted { color: var(--text-muted); }
.mono { font-family: "SF Mono", "Consolas", monospace; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.section-divider { height: 1px; background: var(--border); margin: 18px 0; }
.tag { display:inline-block; background:#EEF0F4; color:var(--text-muted); font-size:11px; padding:2px 8px; border-radius:10px; margin-right:4px;}
.helper-banner { background: var(--info-bg); color: var(--info); padding: 12px 14px; border-radius: 10px; font-size: 12.8px; margin-bottom: 16px; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px){ .grid-2{grid-template-columns:1fr;} .pos-layout{grid-template-columns:1fr;} }

/* ---------------- User avatars ---------------- */
.avatar-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 16px; color: var(--text-faint); flex-shrink: 0;
}
