/* ============================================================
   Black Sheep Helpdesk — Styles
   Black Sheep Restaurants | IT Support Portal
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&display=swap');

:root {
  --gold: #F0DCB9; --gold-dark: #C8A96E; --gold-deep: #A07840;
  --black: #111; --white: #fff;
  --gray-50: #F9F9F9; --gray-100: #F2F2F2; --gray-200: #E5E5E5;
  --gray-300: #D0D0D0; --gray-400: #A0A0A0; --gray-500: #6B6B6B; --gray-700: #3A3A3A;
  --pending: #E8A020; --ongoing: #2E7FD4; --completed: #2EAA6E; --danger: #D44040;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.13);
  --radius: 10px; --radius-sm: 6px;
  --font: 'DM Sans', system-ui, sans-serif;
  --transition: .18s ease;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { overflow-x: hidden; font-family: var(--font); background: var(--gray-50); color: var(--black); min-height: 100vh; font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

/* ── VIEWS ───────────────────────────────────────────────── */
.view { display: none; min-height: 100vh; }
.view.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ── LOGIN / AUTH VIEWS ──────────────────────────────────── */
#loginView.active,
#changePasswordView.active,
#resetPasswordView.active {
  background: var(--black);
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}
#loginView::before, #changePasswordView::before, #resetPasswordView::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(240,220,185,.1) 0%, transparent 65%);
  pointer-events: none;
}
.login-card {
  background: var(--white); border-radius: 16px;
  padding: 44px 40px 32px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45); position: relative; z-index: 1;
}
.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; gap: 10px; }
.login-logo img { height: 68px; width: auto; }
.login-logo-title { font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.login-logo-sub { font-size: 11px; color: var(--gray-400); letter-spacing: .1em; text-transform: uppercase; }
.login-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 22px; }
.login-citation { font-size: 11px; color: var(--gray-400); text-align: center; margin-top: 18px; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--gray-700);
  margin-bottom: 5px; letter-spacing: .05em; text-transform: uppercase;
}
.form-group input:not([type="checkbox"]), .form-group select, .form-group textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--black);
  background: var(--white); transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; appearance: none;
}
.form-group input[type="checkbox"] {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--gold-dark);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(200,169,110,.14);
}
.form-group input:disabled, .form-group select:disabled, .form-group textarea:disabled {
  background: var(--gray-100); color: var(--gray-500); cursor: not-allowed;
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23666'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); padding: 6px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.pw-toggle:hover { color: var(--black); background: var(--gray-100); }
.pw-toggle:active { color: var(--black); }
.pw-toggle svg { width: 18px; height: 18px; display: block; pointer-events: none; }
.required { color: var(--danger); margin-left: 2px; }
.forgot-link { font-size: 12px; color: var(--gold-deep); text-decoration: none; display: block; text-align: center; margin-top: 14px; padding: 8px; }
.forgot-link:hover { text-decoration: underline; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row .full { grid-column: 1 / -1; }
.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.pw-strength { margin-top: 6px; }
.pw-strength-bar { height: 3px; border-radius: 2px; background: var(--gray-200); margin-bottom: 4px; overflow: hidden; }
.pw-strength-fill { height: 100%; border-radius: 2px; transition: width .3s, background .3s; }
.pw-strength-text { font-size: 11px; color: var(--gray-500); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--transition);
  white-space: nowrap; text-decoration: none; line-height: 1;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--black); color: var(--white); width: 100%; padding: 12px; font-size: 14.5px; margin-top: 6px; }
.btn-primary:hover:not(:disabled) { background: var(--gray-700); }
.btn-gold { background: var(--gold); color: var(--black); }
.btn-gold:hover:not(:disabled) { background: var(--gold-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover:not(:disabled) { border-color: var(--gray-400); background: var(--gray-50); }
.btn-ghost { background: transparent; color: var(--gray-500); padding: 8px; border-radius: var(--radius-sm); }
.btn-ghost:hover { background: var(--gray-100); color: var(--black); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #b83030; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-xs { padding: 5px 10px; font-size: 11.5px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-icon svg { width: 16px; height: 16px; }

/* ── APP LAYOUT ──────────────────────────────────────────── */
#appView { flex-direction: row; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--black); color: var(--white);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 20px 18px 16px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo img { height: 34px; width: auto; }
.sidebar-logo-text { font-size: 13px; font-weight: 700; letter-spacing: .03em; line-height: 1.3; }
.sidebar-logo-text small { display: block; font-size: 9.5px; font-weight: 400; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-label { padding: 10px 18px 3px; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.3); }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: rgba(255,255,255,.65);
  transition: all var(--transition); border-left: 2.5px solid transparent;
  user-select: none;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.06); }
.nav-item.active { color: var(--gold); border-left-color: var(--gold); background: rgba(240,220,185,.09); }
.nav-item.active svg { opacity: 1; }
.sidebar-footer {
  padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold); color: var(--black);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  text-transform: uppercase;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }
.logout-btn { background: none; border: none; color: rgba(255,255,255,.35); cursor: pointer; padding: 5px; border-radius: 5px; transition: all var(--transition); display: flex; align-items: center; }
.logout-btn:hover { color: var(--white); background: rgba(255,255,255,.08); }
.logout-btn svg { width: 16px; height: 16px; }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar { width: 100%; box-sizing: border-box;
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--black); padding: 6px; border-radius: var(--radius-sm); }
.hamburger svg { width: 20px; height: 20px; }

/* ── PAGE CONTENT ────────────────────────────────────────── */
.page-body { padding: 24px; flex: 1; max-width: 1600px; width: 100%; box-sizing: border-box; }

/* ── DASHBOARD BANNER ────────────────────────────────────── */
.dash-banner {
  background: linear-gradient(135deg, var(--black) 0%, #2a2a2a 100%); box-sizing: border-box; width: 100%;
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 22px;
  display: flex; align-items: center; gap: 16px; color: var(--white);
}
.dash-banner img { height: 46px; width: auto; opacity: .92; }
.dash-banner h1 { font-size: 20px; font-weight: 700; }
.dash-banner p { font-size: 12.5px; color: var(--gold); margin-top: 2px; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; width: 100%; box-sizing: border-box; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); border-left: 3px solid var(--gray-200); }
.stat-card.c-gold     { border-left-color: var(--gold-dark); }
.stat-card.c-pending  { border-left-color: var(--pending); }
.stat-card.c-ongoing  { border-left-color: var(--ongoing); }
.stat-card.c-done     { border-left-color: var(--completed); }
.stat-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; }

/* ── SECTION HEADER ──────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; box-sizing: border-box; width: 100%; }
.section-header h2 { font-size: 18px; font-weight: 700; }

/* ── FILTER BAR ──────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-family: var(--font); font-size: 13px; color: var(--black); background: var(--white); outline: none; transition: border-color var(--transition); }
.filter-bar select { padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23666'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; appearance: none; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--gold-dark); }
.filter-search { min-width: 200px; }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); overflow-x: auto; box-sizing: border-box; width: 100%; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--black); color: var(--gold); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; padding: 11px 14px; text-align: left; white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.table-empty { text-align: center; padding: 40px; color: var(--gray-400); font-size: 14px; }
.cell-id { font-weight: 700; color: var(--gray-400); font-size: 12px; }
.cell-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.badge-pending   { background: rgba(232,160,32,.12);  color: var(--pending); }
.badge-ongoing   { background: rgba(46,127,212,.12);  color: var(--ongoing); }
.badge-completed { background: rgba(46,170,110,.12);  color: var(--completed); }
.badge-on-hold   { background: rgba(100,116,139,.12); color: #475569; border: 0.5px solid rgba(100,116,139,.35); }
.badge-onhold    { background: rgba(100,116,139,.12); color: #475569; border: 0.5px solid rgba(100,116,139,.35); }
.badge-merged    { background: #7C3AED; color: #FFFFFF; }
.badge-low       { background: rgba(107,107,107,.1);  color: var(--gray-500); }
.badge-medium    { background: rgba(232,160,32,.12);  color: var(--pending); }
.badge-high      { background: rgba(212,64,64,.12);   color: var(--danger); }
.badge-admin     { background: rgba(17,17,17,.08);    color: var(--black); }
.badge-user      { background: rgba(107,107,107,.1);  color: var(--gray-500); }
.badge-active    { background: rgba(46,170,110,.12);  color: var(--completed); }
.badge-inactive  { background: rgba(107,107,107,.1);  color: var(--gray-500); }

/* ── MODALS ──────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.52); z-index: 500; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal-overlay.open { display: flex; animation: fadeIn .15s ease; }
.modal { background: var(--white); border-radius: 14px; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.modal-lg  { max-width: 860px; }
.modal-xl  { max-width: 1060px; }
.modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--white); z-index: 10; flex-shrink: 0; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 4px 6px; border-radius: 5px; display: flex; align-items: center; transition: all var(--transition); }
.modal-close:hover { background: var(--gray-100); color: var(--black); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 22px; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── TICKET DETAIL ───────────────────────────────────────── */
.ticket-detail-head { background: var(--black); color: var(--white); padding: 20px 22px; border-radius: 14px 14px 0 0; }
.ticket-detail-id { font-size: 11px; color: var(--gold); letter-spacing: .08em; margin-bottom: 4px; text-transform: uppercase; }
.ticket-detail-title { font-size: 18px; font-weight: 700; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.ticket-meta-item { font-size: 12px; color: rgba(255,255,255,.6); }
.ticket-meta-item strong { color: var(--gold); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.ticket-body { padding: 20px 22px; }
.ticket-section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); margin-bottom: 8px; margin-top: 18px; }
.ticket-description { font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; color: var(--gray-700); }
.note-item { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 8px; border-left: 3px solid var(--gray-300); }
.note-item.public  { border-left-color: var(--ongoing);   background: rgba(46,127,212,.04); }
.note-item.private { border-left-color: var(--gold-dark); background: rgba(240,220,185,.12); }
.note-meta { font-size: 11px; color: var(--gray-400); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.note-badge { font-size: 9.5px; padding: 2px 7px; border-radius: 10px; font-weight: 700; text-transform: uppercase; }
.note-badge.public  { background: rgba(46,127,212,.15); color: var(--ongoing); }
.note-badge.private { background: rgba(200,169,110,.3);  color: var(--gold-deep); }
.note-body { font-size: 13.5px; line-height: 1.6; }

/* ── TABS ────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn { padding: 9px 18px; background: none; border: none; font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-500); border-bottom: 2.5px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover { color: var(--black); }
.tab-btn.active { color: var(--black); border-bottom-color: var(--gold-dark); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── FIELDS MANAGEMENT ───────────────────────────────────── */
.fields-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-100); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.fields-card-head { background: var(--black); color: var(--white); padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; }
.fields-card-head h3 { font-size: 13px; font-weight: 600; color: var(--gold); }
.fields-card-body { padding: 18px; }
.field-input { flex: 1; padding: 8px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-family: var(--font); font-size: 13px; outline: none; transition: border-color var(--transition); }
.field-input:focus { border-color: var(--gold-dark); }
.field-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; background: var(--gray-100); border-radius: 20px; font-size: 13px; margin: 3px; }
.field-chip-del { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 0 2px; line-height: 1; display: flex; align-items: center; }
.field-chip-del:hover { color: var(--danger); }
.field-chip-del svg { width: 13px; height: 13px; }
.cf-table { width: 100%; border-collapse: collapse; }
.cf-table th { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--gray-500); padding: 8px 12px; border-bottom: 1.5px solid var(--gray-100); text-align: left; }
.cf-table td { padding: 8px 12px; border-bottom: 1px solid var(--gray-100); font-size: 13px; vertical-align: middle; }
.cf-table tr:last-child td { border-bottom: none; }

/* ── REPORTING ───────────────────────────────────────────── */
.report-card { background: var(--white); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm); }
.report-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.report-card > p { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }
.report-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.report-filters select, .report-filters input { padding: 8px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-family: var(--font); font-size: 13px; background: var(--white); outline: none; width: 100%; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-preview { margin-top: 16px; overflow-x: auto; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 20px; }
.chart-box { background: var(--white); border-radius: var(--radius); padding: 18px; border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm); }
.chart-box h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--gray-400); margin-bottom: 14px; }
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { width: 130px; text-align: right; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; font-size: 11.5px; }
.bar-track { flex: 1; background: var(--gray-100); border-radius: 4px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--gold-dark); border-radius: 4px; transition: width .4s ease; }
.bar-val { width: 28px; font-weight: 700; font-size: 12px; }

/* ── SETTINGS ────────────────────────────────────────────── */
.settings-section { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-100); overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.settings-section-head { background: var(--black); padding: 13px 20px; display: flex; align-items: center; gap: 10px; }
.settings-section-head h3 { font-size: 13px; font-weight: 600; color: var(--gold); }
.settings-section-body { padding: 20px; }
.settings-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-form-grid .full { grid-column: 1 / -1; }
.tpl-var-tag { display: inline-block; padding: 2px 7px; background: var(--gray-100); border-radius: 4px; font-size: 11px; font-family: monospace; color: var(--gray-700); margin: 2px; cursor: pointer; border: 1px solid var(--gray-200); }
.tpl-var-tag:hover { background: var(--gold); color: var(--black); border-color: var(--gold-dark); }

/* ── MERGE LIST ──────────────────────────────────────────── */
.merge-list { max-height: 220px; overflow-y: auto; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); }
.merge-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--gray-100); cursor: pointer; }
.merge-item:last-child { border-bottom: none; }
.merge-item:hover { background: var(--gray-50); }
.merge-item input[type=checkbox] { accent-color: var(--gold-dark); width: 15px; height: 15px; flex-shrink: 0; }

/* ── ATTACHMENT ──────────────────────────────────────────── */
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attach-item { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--gray-100); border-radius: var(--radius-sm); font-size: 12px; color: var(--gray-700); }
.attach-item a { color: var(--gray-700); text-decoration: none; }
.attach-item a:hover { color: var(--black); text-decoration: underline; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--black); color: var(--white); padding: 11px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-md); min-width: 220px; max-width: 360px; animation: slideIn .22s ease; border-left: 4px solid var(--gold-dark); pointer-events: all; }
.toast.success { border-left-color: var(--completed); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--ongoing); }
@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--gray-200); border-top-color: var(--black); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.7); z-index: 9000; display: flex; align-items: center; justify-content: center; }

/* ── SIDEBAR OVERLAY ─────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
.sidebar-overlay.visible { display: block; }

/* ── UTILS ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; }
.flex { display: flex; } .items-center { align-items: center; } .flex-wrap { flex-wrap: wrap; } .justify-between { justify-content: space-between; }
.divider { border: none; border-top: 1px solid var(--gray-100); margin: 16px 0; }
.info-box { background: rgba(46,127,212,.07); border: 1px solid rgba(46,127,212,.2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--gray-700); }
.warn-box { background: rgba(232,160,32,.07); border: 1px solid rgba(232,160,32,.25); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--gray-700); }
.success-box { background: rgba(46,170,110,.07); border: 1px solid rgba(46,170,110,.22); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-overlay.visible { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 14px; }
  .topbar { width: 100%; box-sizing: border-box; padding: 0 14px; }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; box-sizing: border-box; }
  .main-content, .page-body { overflow-x: hidden; }
  .table-wrap { overflow-x: auto; }
  .stat-card { padding: 14px 12px; overflow: hidden; max-width: 100%; }
  .stat-card h3 { font-size: 11px; }
  .stat-card .num { font-size: 28px; }
  .data-table { width: 100%; table-layout: fixed; }
  .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header h2 { font-size: 18px; }
  .main-content { padding: 0; overflow-x: hidden; }
  .welcome-banner { padding: 16px; }
  .page-body { padding: 16px; box-sizing: border-box; }
  .welcome-banner h1 { font-size: 20px; }
  .welcome-banner p { font-size: 13px; }
  .dash-banner { padding: 16px; gap: 12px; margin: 0; width: 100%; border-radius: 8px; }
  .dash-banner img { height: 36px; }
  .dash-banner h1 { font-size: 18px; }
  .dash-banner p { font-size: 11px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .section-header { padding: 0; margin: 16px 0 12px; }
  .data-table th:nth-child(n+6), .data-table td:nth-child(n+6) { display: none; }
  .table-wrap { margin: 0; width: 100%; border-radius: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .login-card { padding: 28px 20px 22px; max-width: 100%; border-radius: 12px; }
  #loginView.active, #changePasswordView.active, #resetPasswordView.active { min-height: 100vh; min-height: 100dvh; padding: 16px; }
  .modal { max-width: 100%; border-radius: 12px; margin: 0; max-height: 90vh; align-self: center; }
  .modal-overlay { align-items: center; padding: 16px; }
  .filter-search { min-width: 140px; }
}

@media (hover: none) {
  .data-table tr:hover td { background: transparent; }
}

/* Settings tab panels — always block, never flex */
#stEmail.active,
#stTemplates.active {
  display: block !important;
}

/* ── MOBILE TABLE COLUMN VISIBILITY ──────────────────────── */
@media (max-width: 480px) {
  /* User Management - hide CLUSTER and RESTAURANT columns (4th and 5th) */
  #usersBody tr td:nth-child(4),
  #usersBody tr td:nth-child(5),
  #page-users .data-table th:nth-child(4),
  #page-users .data-table th:nth-child(5) {
    display: none;
  }
  
  /* Asset Management - show only: Asset ID (1), Name (2), Location (13), Actions (19) */
  #assetTable th,
  #assetTable td {
    display: none;
  }
  
  #assetTable th:nth-child(1),
  #assetTable td:nth-child(1),
  #assetTable th:nth-child(2),
  #assetTable td:nth-child(2),
  #assetTable th:nth-child(13),
  #assetTable td:nth-child(13),
  #assetTable th:nth-child(19),
  #assetTable td:nth-child(19) {
    display: table-cell;
  }
  
  /* Make Asset table header fill full width */
  #assetTable {
    width: 100%;
    table-layout: fixed;
  }
  
  #assetTable th:nth-child(1),
  #assetTable td:nth-child(1) {
    width: 25%;
  }
  
  #assetTable th:nth-child(2),
  #assetTable td:nth-child(2) {
    width: 35%;
  }
  
  #assetTable th:nth-child(13),
  #assetTable td:nth-child(13) {
    width: 25%;
  }
  
  #assetTable th:nth-child(19),
  #assetTable td:nth-child(19) {
    width: 15%;
  }
  
  /* Better table cell spacing on mobile */
  #page-users .data-table th,
  #page-users .data-table td,
  #assetTable th,
  #assetTable td {
    padding: 10px 8px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
/* === desktop sidebar collapse (full-hide via topbar hamburger) === */
@media (min-width: 769px) {
  .hamburger { display: flex; }
  .sidebar, .main-content { transition: transform .25s ease, margin-left .25s ease; }
  html.sidebar-collapsed .sidebar { transform: translateX(-100%); box-shadow: none; }
  html.sidebar-collapsed .main-content { margin-left: 0; }
}

/* v3b-cards */
.c-onhold  { border-left: 4px solid #475569; }
.c-merged  { border-left: 4px solid #7C3AED; }

/* v3-monitor-picker */
.mon-picker { position:relative; }
.mon-chips { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:4px; }
.mon-chip { display:inline-flex; align-items:center; gap:5px; background:#EEEDFE; color:#3C3489; padding:3px 8px; border-radius:12px; font-size:12px; font-weight:500; }
.mon-chip-x { cursor:pointer; font-size:14px; line-height:1; padding:0 2px; font-style:normal; opacity:.7; }
.mon-chip-x:hover { opacity:1; }
.mon-search { width:100%; padding:8px 10px; border:1px solid var(--gray-200); border-radius:6px; font-size:13px; box-sizing:border-box; }
.mon-search:focus { outline:none; border-color:#7C3AED; }
.mon-dropdown { position:absolute; top:100%; left:0; right:0; background:#fff; border:1px solid var(--gray-200); border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,0.08); max-height:220px; overflow-y:auto; z-index:1000; margin-top:2px; }
.mon-row { display:flex; justify-content:space-between; align-items:center; padding:8px 12px; border-bottom:0.5px solid var(--gray-100); cursor:pointer; }
.mon-row:last-child { border-bottom:none; }
.mon-row-active, .mon-row:hover { background:#EEEDFE; }
.mon-row-l { min-width:0; }
.mon-name { font-size:13px; font-weight:500; color:#111; }
.mon-email { font-size:11px; color:#666; overflow:hidden; text-overflow:ellipsis; }
.mon-badge { font-size:10px; padding:2px 6px; border-radius:10px; font-weight:500; margin-left:8px; flex-shrink:0; }
.mon-badge-admin { background:#E6F1FB; color:#0C447C; }
.mon-badge-tech  { background:#EAF3DE; color:#3B6D11; }
.mon-badge-user  { background:#F1EFE8; color:#5F5E5A; }
.mon-empty { padding:10px 12px; font-size:12px; color:#888; text-align:center; }

/* v4-unread-indicators */
.unread-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#7C3AED; margin-right:6px; vertical-align:middle; }
.new-pill { display:inline-block; background:#E6F1FB; color:#0C447C; font-size:10px; padding:2px 7px; border-radius:10px; margin-left:8px; font-weight:600; letter-spacing:.03em; vertical-align:middle; }
.notes-pill { display:inline-block; background:#D6C7F7; color:#2D1B69; font-size:10px; padding:2px 7px; border-radius:10px; margin-left:6px; font-weight:600; letter-spacing:.03em; vertical-align:middle; }
.ticket-row-unread { background: #DCD1F7; box-shadow: inset 5px 0 0 #5B21B6; }
.ticket-row-unread:hover { background: #C9B8F1; }

/* v4e-purple-visible */

/* v4f-row-visible */


/* v4h-activity-bell */
.bell-btn { position:relative; background:transparent; border:none; padding:6px; cursor:pointer; color:#333; display:inline-flex; align-items:center; justify-content:center; border-radius:6px; }
.bell-btn:hover { background:#f0f0f0; }
.bell-badge { position:absolute; top:0; right:0; background:#7C3AED; color:#fff; font-size:10px; font-weight:700; min-width:16px; height:16px; padding:0 4px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; box-shadow:0 0 0 2px #fff; line-height:1; }
.bell-dropdown { position:absolute; top:52px; right:16px; width:360px; background:#fff; border:1px solid #ddd; border-radius:10px; box-shadow:0 12px 32px rgba(0,0,0,0.16); z-index:1000; max-height:520px; overflow:hidden; display:flex; flex-direction:column; }
.bell-head { padding:14px 16px; border-bottom:1px solid #eee; display:flex; justify-content:space-between; align-items:center; background:#fafafa; }
.bell-title { font-size:14px; font-weight:600; color:#111; }
.bell-sub { font-size:11px; color:#666; margin-top:2px; }
.bell-clear { font-size:11px; color:#7C3AED; font-weight:600; cursor:pointer; }
.bell-clear:hover { text-decoration:underline; }
.bell-list { overflow-y:auto; max-height:420px; }
.bell-empty { padding:24px 16px; text-align:center; font-size:12px; color:#888; }
.bell-row { padding:12px 16px; border-bottom:1px solid #f0f0f0; cursor:pointer; display:flex; gap:10px; justify-content:space-between; align-items:flex-start; }
.bell-row:last-child { border-bottom:none; }
.bell-row:hover { background:#fafafa; }
.bell-row-unread { background:#DCD1F7; border-left:3px solid #5B21B6; padding-left:13px; }
.bell-row-unread:hover { background:#C9B8F1; }
.bell-row-l { min-width:0; flex:1; }
.bell-row-main { font-size:12.5px; color:#111; line-height:1.4; }
.bell-row-main .bell-tref { color:#5B21B6; font-weight:600; }
.bell-preview { font-size:11px; color:#666; margin-top:3px; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.bell-row-meta { font-size:10px; color:#999; margin-top:4px; }
.bell-tag { font-size:9px; padding:2px 6px; border-radius:8px; font-weight:700; letter-spacing:.04em; white-space:nowrap; align-self:flex-start; }
.bell-tag-note { background:#D6C7F7; color:#2D1B69; }
.bell-tag-private { background:#5B21B6; color:#fff; }
.bell-tag-new { background:#E6F1FB; color:#0C447C; }
.bell-tag-update { background:#FAEEDA; color:#7c5410; }
.bell-tag-other { background:#F1EFE8; color:#5F5E5A; }


/* v5-sla-pills */
.sla-pill { display:inline-block; font-size:10px; padding:3px 8px; border-radius:10px; font-weight:600; letter-spacing:.04em; white-space:nowrap; }
.sla-ontrack { background:#EAF3DE; color:#3B6D11; }
.sla-ack1d   { background:#FAEEDA; color:#7c5410; font-weight:700; }
.sla-ack3d   { background:#FAECE7; color:#993C1D; font-weight:700; }
.sla-urgent  { background:#A32D2D; color:#fff; font-weight:700; }
.sla-onhold  { background:#F1EFE8; color:#5F5E5A; }

.ticket-row-ack1d   { background:#fff9eb; box-shadow: inset 5px 0 0 #B77012; }
.ticket-row-ack1d:hover { background:#fdf1cf; }
.ticket-row-overdue { background:#fdecec; box-shadow: inset 5px 0 0 #D85A30; }
.ticket-row-overdue:hover { background:#fbdbcd; }
.ticket-row-urgent  { background:#fbdada; box-shadow: inset 5px 0 0 #A32D2D; }
.ticket-row-urgent:hover { background:#f7c1c1; }
.ticket-row-urgent td { color:#791F1F; font-weight:600; }


/* v5c-hide-broken-button — bulk-resend endpoint has a known loop bug (v5c incident). Kill switch active. Do NOT re-enable without a rewrite (see handoff). */
#resendInvitesBtn { display: none !important; }
