* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ── SCROLLBAR ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
  opacity: 0.7;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent2);
}
::-webkit-scrollbar-corner {
  background: transparent;
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
:root {
  --primary: #1a1a2e;
  --primary2: #16213e;
  --accent: #c9a84c;
  --accent2: #e8c96a;
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface2: #f8f6f1;
  --text: #1c1917;
  --text2: #6b6560;
  --text3: #a09c98;
  --border: #e8e3d9;
  --danger: #c0392b;
  --success: #27ae60;
  --info: #2980b9;
  --sidebar-w: 278px;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --font-head:
    "Cairo", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
    sans-serif;
  --font-body:
    "Cairo", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
    sans-serif;
}
[data-theme="dark"] {
  --primary: #0d0d1a;
  --primary2: #111126;
  --bg: #0c0c18;
  --surface: #161628;
  --surface2: #1e1e34;
  --text: #ede9e0;
  --text2: #9b97a8;
  --text3: #5e5a6b;
  --border: #2a2a42;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  min-height: 100vh;
  transition:
    background 0.3s,
    color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
/* Browsers don't inherit font-family on form elements — force it */
input,
textarea,
select,
button {
  font-family: inherit;
}
/* Auto-detect RTL/LTR per input — so Arabic/Kurdish text looks correct even in English mode */
input,
textarea {
  unicode-bidi: plaintext;
  direction: auto;
}
/* ── KURDISH / ARABIC ─────────────────────────────────────────────────────── */
/* Body base — font-size bump + smooth rendering */
[lang="ku"] body,
[lang="ar"] body {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Kurdish — font variables only */
[lang="ku"] {
  --font-body:
    "Noto Sans Arabic", "Cairo", "System Emoji", "Segoe UI Emoji",
    "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  --font-head:
    "Noto Sans Arabic", "Cairo", "System Emoji", "Segoe UI Emoji",
    "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-synthesis: none;
}
/* Ligatures & kerning — REQUIRED for Arabic/Kurdish letter joining */
[lang="ku"],
[lang="ar"] {
  font-feature-settings:
    "liga" 1,
    "calt" 1,
    "kern" 1;
  font-variant-ligatures: common-ligatures;
  word-spacing: 0;
  letter-spacing: 0;
}
/* Line-height ONLY on block/text containers — NOT on * which breaks icons & badges */
[lang="ku"]
  :is(
    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    div,
    span,
    a,
    label,
    li,
    td,
    th,
    button,
    textarea,
    select
  ),
[lang="ar"]
  :is(
    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    div,
    span,
    a,
    label,
    li,
    td,
    th,
    button,
    textarea,
    select
  ) {
  line-height: 1.65;
}
/* Inputs — tighter so text sits centered inside the box */
[lang="ku"] input,
[lang="ar"] input {
  line-height: 1.4;
  height: auto;
}
/* Icons — restore tabler font and reset line-height so they render at normal size */
[lang="ku"] .ti,
[lang="ar"] .ti {
  font-family: "tabler-icons" !important;
  line-height: 1 !important;
  font-size: inherit !important;
  font-feature-settings: normal !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
}
/* Emoji-only containers (sidebar/login logo) */
[lang="ku"] .sidebar-logo-img,
[lang="ar"] .sidebar-logo-img,
[lang="ku"] .login-logo-icon,
[lang="ar"] .login-logo-icon {
  font-family:
    "System Emoji", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
    sans-serif !important;
}
/* Nav badge counter — fixed height, centered */
[lang="ku"] #hk-nav-badge,
[lang="ar"] #hk-nav-badge {
  line-height: 1.4 !important;
}
/* Table cells — consistent baseline */
[lang="ku"] td,
[lang="ku"] th,
[lang="ar"] td,
[lang="ar"] th {
  vertical-align: middle;
}
/* Sidebar nav items — keep items vertically centered despite RTL line-height */
[lang="ku"] .nav-item,
[lang="ar"] .nav-item {
  line-height: 1 !important;
}
#app {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary2) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s;
  box-shadow: 3px 0 24px rgba(0, 0, 0, 0.18);
}
.sidebar-logo {
  padding: 30px 22px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-logo-img {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(201, 168, 76, 0.4);
}
.sidebar-name {
  color: #fff;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.sidebar-sub {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  margin-top: 4px;
  letter-spacing: 0.01em;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--accent2);
  opacity: 0.4;
  border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  opacity: 0.75;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 11px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  font-weight: 400;
  transition: all 0.2s;
  margin-bottom: 3px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.88);
}
.nav-item.active {
  background: rgba(201, 168, 76, 0.18);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item i {
  font-size: 20px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.nav-section {
  color: rgba(255, 255, 255, 0.22);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 16px 16px 6px;
  margin-top: 2px;
}
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ── MAIN ─────────────────────────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
#topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}
.topbar-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.topbar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201, 168, 76, 0.05);
}
.badge {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a1a1a;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
#content {
  padding: 36px;
  flex: 1;
}

/* ── STAT CARDS ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.stat-card.gold {
  background: linear-gradient(135deg, #fffbf0 0%, #fff 60%);
  border-color: rgba(201, 168, 76, 0.3);
}
.stat-card.blue {
  background: linear-gradient(135deg, #eff6ff 0%, #fff 60%);
  border-color: rgba(41, 128, 185, 0.2);
}
.stat-card.green {
  background: linear-gradient(135deg, #edfbf3 0%, #fff 60%);
  border-color: rgba(39, 174, 96, 0.2);
}
.stat-card.red {
  background: linear-gradient(135deg, #fff1f0 0%, #fff 60%);
  border-color: rgba(192, 57, 43, 0.2);
}
[data-theme="dark"] .stat-card.gold {
  background: linear-gradient(
    135deg,
    rgba(201, 168, 76, 0.1) 0%,
    var(--surface) 60%
  );
  border-color: rgba(201, 168, 76, 0.25);
}
[data-theme="dark"] .stat-card.blue {
  background: linear-gradient(
    135deg,
    rgba(41, 128, 185, 0.1) 0%,
    var(--surface) 60%
  );
  border-color: rgba(41, 128, 185, 0.2);
}
[data-theme="dark"] .stat-card.green {
  background: linear-gradient(
    135deg,
    rgba(39, 174, 96, 0.1) 0%,
    var(--surface) 60%
  );
  border-color: rgba(39, 174, 96, 0.2);
}
[data-theme="dark"] .stat-card.red {
  background: linear-gradient(
    135deg,
    rgba(192, 57, 43, 0.1) 0%,
    var(--surface) 60%
  );
  border-color: rgba(192, 57, 43, 0.2);
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 76px;
  height: 76px;
  border-radius: 0 var(--radius) 0 76px;
  opacity: 0.1;
}
.stat-card.gold::before {
  background: var(--accent);
}
.stat-card.blue::before {
  background: #2980b9;
}
.stat-card.green::before {
  background: #27ae60;
}
.stat-card.red::before {
  background: #c0392b;
}
.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.stat-value {
  font-size: 34px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--text);
  line-height: 1;
}
.stat-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 8px;
}
.stat-icon {
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 32px;
}
.stat-card.gold .stat-icon {
  color: var(--accent);
  opacity: 0.5;
}
.stat-card.blue .stat-icon {
  color: #2980b9;
  opacity: 0.5;
}
.stat-card.green .stat-icon {
  color: #27ae60;
  opacity: 0.5;
}
.stat-card.red .stat-icon {
  color: #c0392b;
  opacity: 0.5;
}

/* ── TABLES ───────────────────────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}
.table-header {
  padding: 20px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.table-header h3 {
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-head);
}
.table-search {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  width: 220px;
  transition: border 0.2s;
}
.table-search:focus {
  outline: none;
  border-color: var(--accent);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: var(--surface2);
  color: var(--text2);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  vertical-align: middle;
  text-align: center;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: var(--surface2);
  transition: background 0.15s;
}

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a1a1a;
  box-shadow: 0 2px 10px rgba(201, 168, 76, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(201, 168, 76, 0.42);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201, 168, 76, 0.04);
}
.btn-danger {
  background: transparent;
  border: 1.5px solid rgba(231, 76, 60, 0.4);
  color: #e74c3c;
  padding: 8px 14px;
}
.btn-danger:hover {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
  transform: translateY(-1px);
}
.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

/* Compact action buttons inside table cells */
td > div > .btn,
td > div > .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  gap: 4px;
  border-radius: 5px;
  white-space: nowrap;
}
td > div > .btn-danger {
  padding: 5px 10px;
}
/* Actions wrapper div inside td */
td > .td-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: nowrap;
}

/* ── STATUS BADGES ────────────────────────────────────────────────────────── */
.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status-available {
  background: #16a34a;
  color: #fff;
}
.status-occupied {
  background: #4f46e5;
  color: #fff;
}
.status-maintenance {
  background: #ea580c;
  color: #fff;
}
.status-cleaning {
  background: #2563eb;
  color: #fff;
}
.status-inspection {
  background: #7c3aed;
  color: #fff;
}

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 22px;
  width: 100%;
  max-width: 740px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-head {
  padding: 28px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
}
.modal-body {
  padding: 22px 28px 28px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  font-family: var(--font-body);
  transition:
    border 0.2s,
    box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── LOGIN ────────────────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #0d0d20 50%, #14112a 100%);
  position: relative;
  overflow: hidden;
}
#login-screen::before {
  content: "";
  position: absolute;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(201, 168, 76, 0.09) 0%,
    transparent 70%
  );
  top: -160px;
  right: -160px;
  animation: glow 7s ease-in-out infinite;
}
#login-screen::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(201, 168, 76, 0.05) 0%,
    transparent 70%
  );
  bottom: -100px;
  left: -100px;
}
@keyframes glow {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.7;
  }
}
.login-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 52px;
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(201, 168, 76, 0.18);
  border: 1px solid rgba(201, 168, 76, 0.12);
}
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo-icon {
  width: 82px;
  height: 82px;
  background: linear-gradient(
    135deg,
    rgba(201, 168, 76, 0.22),
    rgba(201, 168, 76, 0.08)
  );
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 36px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  box-shadow: 0 6px 20px rgba(201, 168, 76, 0.22);
}
.login-logo h1 {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 6px;
}
.login-logo p {
  color: #6b6560;
  font-size: 15px;
}
.login-form .form-group input {
  padding: 15px 18px;
  font-size: 16px;
}
/* Fixed login design — always identical regardless of the selected theme / dark mode */
#login-screen .login-form .form-group label {
  color: #6b6560;
}
#login-screen .login-form .form-group input {
  background: #f8f6f1;
  border: 1.5px solid #e8e3d9;
  color: #1c1917;
}
#login-screen .login-form .form-group input:focus {
  border-color: #c9a84c;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}
#login-screen .login-form .btn-primary {
  background: #c9a84c;
  border-color: #c9a84c;
  color: #1a1a1a;
}
#login-screen .login-form .btn-primary:hover {
  background: #b89640;
  border-color: #b89640;
}
.login-err {
  background: rgba(192, 57, 43, 0.07);
  color: #c0392b;
  border: 1px solid rgba(192, 57, 43, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
[data-theme="dark"] .login-err {
  background: rgba(192, 57, 43, 0.12);
  color: #e74c3c;
  border-color: rgba(192, 57, 43, 0.3);
}

/* ── SETTINGS ─────────────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.settings-card:hover {
  box-shadow: var(--shadow-md);
}
.settings-card h4 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
  font-family: var(--font-head);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
}
.color-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}
.color-swatch:hover,
.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.15);
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 9px;
}
.theme-card {
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all 0.2s;
  background: var(--surface);
}
.theme-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.theme-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.theme-card-preview {
  height: 54px;
  display: flex;
}
.theme-card-name {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 7px;
  color: var(--text2);
  background: var(--surface2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child {
  border-bottom: none;
}
.toggle {
  width: 46px;
  height: 25px;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
}
.toggle.on {
  background: var(--accent);
}
.toggle::after {
  content: "";
  width: 21px;
  height: 21px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: 0.3s;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.22);
}
.toggle.on::after {
  left: 23px;
}
.logo-preview {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  background: var(--surface2);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}
.logo-preview:hover {
  border-color: var(--accent);
}
.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.section-head {
  font-family: var(--font-head);
  font-size: 28px;
  margin-bottom: 8px;
  font-weight: 700;
}
.section-sub {
  color: var(--text2);
  font-size: 15px;
  margin-bottom: 26px;
}

/* ── LANGUAGE BUTTONS ─────────────────────────────────────────────────────── */
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-family: var(--font-body);
  transition: all 0.2s;
  min-width: 120px;
}
.lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201, 168, 76, 0.05);
}
.lang-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a1a1a;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 3px 14px rgba(201, 168, 76, 0.35);
}
.lang-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ── CHART ────────────────────────────────────────────────────────────────── */
.income-bar-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.chart-bar-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding: 0 4px;
}
.chart-bar {
  flex: 1;
  background: linear-gradient(to top, var(--accent), var(--accent2));
  border-radius: 7px 7px 0 0;
  min-width: 24px;
  transition: height 0.6s ease;
  opacity: 0.75;
  cursor: pointer;
  position: relative;
}
.chart-bar:hover {
  opacity: 1;
}
.chart-bar::after {
  content: attr(data-v);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text2);
  white-space: nowrap;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.chart-labels {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  margin-top: 7px;
}
.chart-labels span {
  flex: 1;
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  min-width: 24px;
}

/* ── ROOMS ────────────────────────────────────────────────────────────────── */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  padding: 4px;
}
.room-tile {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}
.room-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.room-tile::before {
  content: "";
  display: block;
  height: 6px;
  flex-shrink: 0;
}
.room-tile.occupied::before {
  background: linear-gradient(90deg, #4f46e5, #8b5cf6);
}
.room-tile.available::before {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}
.room-tile.cleaning::before {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}
.room-tile.maintenance::before {
  background: linear-gradient(90deg, #ea580c, #fbbf24);
}
.room-tile.inspection::before {
  background: linear-gradient(90deg, #7c3aed, #c026d3);
}
.room-tile.occupied {
  border-color: rgba(79, 70, 229, 0.5);
}
.room-tile.available {
  border-color: rgba(22, 163, 74, 0.5);
}
.room-tile.cleaning {
  border-color: rgba(37, 99, 235, 0.5);
}
.room-tile.maintenance {
  border-color: rgba(234, 88, 12, 0.5);
}
.room-tile.inspection {
  border-color: rgba(124, 58, 237, 0.5);
}
.rt-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.rt-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.rt-numbox {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.room-tile .rnum {
  font-size: 28px;
  font-weight: 900;
  font-family: var(--font-head);
  line-height: 1;
  color: var(--text);
}
.room-tile .rtype {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.rt-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.rt-price-tag {
  font-size: 13px;
  color: var(--accent);
  font-weight: 800;
}
.rt-sep {
  color: var(--border);
  font-size: 14px;
}
.rt-cap {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 3px;
}
.rt-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}
.rt-guest {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rt-guest-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.rt-guest-name .ti {
  font-size: 14px;
  color: var(--text3);
  flex-shrink: 0;
}
.rt-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #16a34a;
  padding: 6px 13px;
  border-radius: 8px;
  text-decoration: none;
  transition:
    background 0.18s,
    transform 0.12s;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
  width: fit-content;
  margin-top: 2px;
}
.rt-phone:hover {
  background: #15803d;
  transform: translateY(-1px);
}
.rt-phone:active {
  transform: translateY(0);
}
.rt-phone .ti {
  font-size: 14px;
}
.room-tile .raction {
  padding: 0 16px 14px;
  margin-top: auto;
}
.room-tile .raction .btn {
  width: 100%;
  justify-content: center;
  font-size: 12px;
  padding: 7px 8px;
}

@keyframes roomWiggle {
  0%,
  100% {
    transform: rotate(-2.5deg) scale(1.01);
  }
  25% {
    transform: rotate(2.5deg) scale(1.01);
  }
  50% {
    transform: rotate(-1.5deg) scale(1.01);
  }
  75% {
    transform: rotate(1.5deg) scale(1.01);
  }
}
.room-tile.wiggle {
  animation: roomWiggle 0.45s ease-in-out infinite;
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.25) !important;
}
.room-tile.wiggle:hover {
  transform: none;
}

@keyframes urgentPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}
.room-urgent {
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  animation: urgentPulse 1.2s ease-in-out infinite;
}
.room-urgent.notpaid {
  background: #922b21;
  color: #fff;
}
.room-tile.has-urgent {
  border-color: rgba(192, 57, 43, 0.7) !important;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2) !important;
}
.room-tile.has-group::before {
  background: var(--grp-clr) !important;
}
.room-tile.has-group {
  border-color: var(--grp-clr) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--grp-clr) 20%, transparent) !important;
}
.grp-tile-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  margin-top: 6px;
}
.phone-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #16a34a;
  text-decoration: none;
  font-weight: 700;
  transition: opacity 0.15s;
}
.phone-link:hover {
  opacity: 0.75;
}
.phone-link .ti {
  font-size: 14px;
}

/* ── LOADING ──────────────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 56px;
  color: var(--text3);
  font-size: 16px;
}

/* ── GROUP BOOKING ───────────────────────────────────────────────────────── */
.grp-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.grp-room-row {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition:
    border-color 0.18s,
    background 0.18s;
}
.grp-room-row:has(.grp-room-cb:checked) {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.05);
}
.grp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.grp-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  border-top: 4px solid #7c3aed;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}
.grp-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.grp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.grp-card-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}
.grp-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text2);
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 8px;
}

/* ── HAMBURGER BUTTON ─────────────────────────────────────────────────────── */
.hamburger-btn {
  display: none;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 20px;
  align-items: center;
  line-height: 1;
  transition: all 0.2s;
}
.hamburger-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── SIDEBAR BACKDROP ─────────────────────────────────────────────────────── */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99;
  backdrop-filter: blur(2px);
}
#sidebar-backdrop.active {
  display: block;
}

/* ── PRICE DEFAULT / EDITED INDICATOR ────────────────────────────────────── */
.form-group input.price-default {
  border-color: var(--accent) !important;
  background: rgba(201, 168, 76, 0.07) !important;
  color: var(--accent) !important;
  font-weight: 700;
}
.form-group input.price-edited {
  border-color: #2980b9 !important;
  background: rgba(41, 128, 185, 0.05) !important;
  color: #2980b9 !important;
  font-weight: 700;
}
.ppn-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 10px;
  font-weight: 700;
  vertical-align: middle;
  margin-inline-start: 7px;
}
.ppn-auto {
  background: rgba(201, 168, 76, 0.15);
  color: var(--accent);
}
.ppn-edited {
  background: rgba(41, 128, 185, 0.12);
  color: #2980b9;
}

/* ── ARCHIVE CARDS ────────────────────────────────────────────────────────── */
.arc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.arc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.arc-card:hover {
  box-shadow: var(--shadow-md);
}

/* ── ARCHIVE DETAIL GRID (table view expand) ──────────────────────────────── */
.arc-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  #content {
    padding: 24px;
  }
}
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }
  #sidebar {
    transform: translateX(-100%);
    z-index: 200;
    transition: transform 0.3s ease;
  }
  #sidebar.open {
    transform: translateX(0);
  }
  [dir="rtl"] #sidebar {
    transform: translateX(100%);
  }
  [dir="rtl"] #sidebar.open {
    transform: translateX(0);
  }
  #main {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100vw;
    overflow-x: hidden;
  }
  #topbar {
    padding: 0 14px;
  }
  #content {
    padding: 14px;
    overflow-x: hidden;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 18px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .table-card {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
  .table-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
  }
  .table-header > * {
    flex-shrink: 0;
  }
  table {
    min-width: 500px;
    width: max-content;
  }
  td,
  th {
    padding: 12px 14px;
  }
  .income-bar-container {
    padding: 16px;
    overflow-x: hidden;
  }
  .room-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 9px;
  }
  .modal {
    border-radius: 20px 20px 0 0;
    max-width: 100vw;
    width: 100%;
    margin: 0;
    position: fixed;
    bottom: 0;
    top: auto;
    max-height: 92vh;
    overflow-y: auto;
  }
  .overlay {
    padding: 0;
    align-items: flex-end;
  }
  .chart-bar-wrap {
    height: 100px;
  }
  .topbar-title {
    font-size: 17px;
  }
  .section-head {
    font-size: 20px;
  }
  .stat-value {
    font-size: 26px;
  }
  .stat-card {
    padding: 16px;
  }
  .topbar-right .badge {
    display: none;
  }
  .arc-detail-grid {
    grid-template-columns: 1fr;
  }
  .table-search {
    width: 100%;
  }
  .arc-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-today-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 600px) {
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat-value {
    font-size: 24px;
  }
  .section-head {
    font-size: 18px;
  }
  .section-sub {
    font-size: 13px;
  }
  .room-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .room-tile {
    min-height: auto;
  }
  .btn {
    font-size: 13px;
  }
  .arc-cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
@media (max-width: 480px) {
  .stat-value {
    font-size: 22px;
  }
  .stat-card {
    padding: 12px 14px;
  }
  .stat-icon {
    font-size: 24px;
    top: 14px;
    right: 14px;
  }
  .lang-row {
    flex-direction: column;
  }
  .lang-btn {
    justify-content: center;
    min-width: unset;
    width: 100%;
  }
  #content {
    padding: 8px;
  }
  .table-header {
    padding: 12px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-head {
    padding: 18px 16px 0;
  }
  .modal-head h3 {
    font-size: 18px;
  }
  td,
  th {
    padding: 10px 10px;
    font-size: 13px;
  }
  .arc-detail-grid {
    grid-template-columns: 1fr;
  }
  .arc-card {
    padding: 14px;
  }
  .arc-cards-grid {
    gap: 8px;
  }
}

/* ── BIDI: mixed-language data renders correctly regardless of UI language ── */
td,
th,
input,
textarea,
select {
  unicode-bidi: plaintext;
}

/* ── PRINT RECEIPT (thermal 80mm roll printer) ───────────────────────────── */
.receipt-window {
  display: none;
}
@media print {
  body > *:not(.receipt-window) {
    display: none !important;
  }
  .receipt-window {
    display: block !important;
  }
}

/* ── RTL ──────────────────────────────────────────────────────────────────── */
[dir="rtl"] #sidebar {
  left: auto;
  right: 0;
}
[dir="rtl"] #main {
  margin-left: 0;
  margin-right: var(--sidebar-w);
}
[dir="rtl"] .stat-icon {
  right: auto;
  left: 22px;
}
[dir="rtl"] .stat-card::before {
  right: auto;
  left: 0;
  border-radius: var(--radius) 0 76px 0;
}
[dir="rtl"] .nav-item.active::before {
  left: auto;
  right: 0;
  border-radius: 3px 0 0 3px;
}
[dir="rtl"] .modal-head {
  flex-direction: row-reverse;
}
[dir="rtl"] .table-header {
  flex-direction: row-reverse;
}
[dir="rtl"] th {
  text-align: center;
}
[dir="rtl"] .nav-item {
  flex-direction: row-reverse;
  text-align: right;
}
[dir="rtl"] .nav-item.active::before {
  border-radius: 3px 0 0 3px;
}
[dir="rtl"] .toggle-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .topbar-right {
  flex-direction: row-reverse;
}


/* ══════════════════════════════════════════════════════════════════════════
   PAGE HEADER UTILITY CLASSES
   ══════════════════════════════════════════════════════════════════════════ */
.page-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-hd-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — LARGE TABLET / SMALL LAPTOP  ≤ 1280px
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  :root { --sidebar-w: 260px; }
  #content { padding: 28px; }
  .stat-grid { gap: 16px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  ≤ 1024px  (iPad landscape, small laptop)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 230px; }
  #content { padding: 22px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .section-head { font-size: 24px; }
  .section-sub  { font-size: 14px; margin-bottom: 20px; }
  .grp-cards-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .settings-grid  { grid-template-columns: 1fr 1fr; }
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .stat-value { font-size: 30px; }
  .topbar-title { font-size: 20px; }
  .page-hd-btns .btn { font-size: 13px; padding: 8px 14px; }
  .page-hd-btns .btn-sm { font-size: 12px; padding: 6px 11px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET PORTRAIT  ≤ 768px
   Existing rules supplemented below
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .page-hd { margin-bottom: 14px; gap: 8px; }
  .page-hd-btns .btn { font-size: 12px; padding: 7px 11px; gap: 5px; }
  .page-hd-btns .btn-sm { font-size: 11px; padding: 6px 9px; }
  .grp-cards-grid { grid-template-columns: 1fr; }
  .settings-grid  { grid-template-columns: 1fr; }
  .section-head { font-size: 20px; }
  .section-sub  { font-size: 13px; margin-bottom: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 26px; }
  .stat-card  { padding: 16px; }
  .topbar-title { font-size: 16px; }
  #topbar { height: 60px; padding: 0 12px; }
  .modal { max-width: 100vw; }
  /* Ensure table containers scroll without clipping */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  /* Footer compact */
  footer { padding: 12px 16px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — LARGE PHONE  ≤ 640px
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card  { padding: 14px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }
  .section-head { font-size: 18px; }
  #content { padding: 12px; }
  .page-hd-btns .btn { font-size: 12px; padding: 7px 10px; }
  .page-hd-btns .btn-sm { padding: 6px 8px; font-size: 11px; }
  .topbar-title { font-size: 15px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — PHONE  ≤ 480px
   Existing rules supplemented below
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .page-hd { margin-bottom: 10px; }
  .page-hd-btns { gap: 4px; }
  .page-hd-btns .btn { font-size: 11px; padding: 7px 8px; gap: 3px; }
  .page-hd-btns .btn-sm { padding: 5px 7px; }
  .grp-cards-grid { grid-template-columns: 1fr; }
  .stat-grid  { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .stat-value { font-size: 20px; }
  .stat-card  { padding: 11px 12px; }
  .stat-icon  { font-size: 22px; top: 12px; right: 12px; }
  .section-head { font-size: 17px; }
  .section-sub  { font-size: 12px; }
  table { min-width: 380px; }
  td, th { padding: 10px 10px; font-size: 12px; }
  .topbar-title {
    font-size: 14px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Login card compact */
  .login-card { padding: 32px 20px; }
  .login-logo h1 { font-size: 22px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONE  ≤ 390px  (iPhone 14, Galaxy S22 etc.)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 390px) {
  :root { --radius: 12px; --radius-sm: 8px; }
  #content { padding: 6px; }
  .stat-grid { grid-template-columns: 1fr; gap: 6px; }
  .stat-card  { padding: 10px 12px; }
  .stat-value { font-size: 20px; }
  .stat-icon  { font-size: 20px; top: 10px; right: 10px; }
  .page-hd-btns .btn { font-size: 11px; padding: 6px 7px; gap: 3px; }
  .topbar-title { font-size: 13px; max-width: 130px; }
  #topbar { padding: 0 8px; }
  table { min-width: 340px; }
  .modal-head { padding: 14px 14px 0; }
  .modal-body { padding: 14px; }
  .login-card { padding: 24px 14px; border-radius: 18px; }
  .section-head { font-size: 16px; }
  .btn { font-size: 12px; padding: 9px 14px; }
  .btn-sm { font-size: 11px; padding: 6px 9px; }
  /* Footer: stack everything */
  footer { flex-direction: column !important; text-align: center; gap: 6px !important; padding: 10px 8px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   ENSURE CONTENT NEVER CAUSES HORIZONTAL SCROLL
   ══════════════════════════════════════════════════════════════════════════ */
#content > * { max-width: 100%; }
.page-hd > * { min-width: 0; }
.page-hd-btns { max-width: 100%; }


/* ══════════════════════════════════════════════════════════════════════════
   MODAL — prevent horizontal overflow on all screen sizes
   ══════════════════════════════════════════════════════════════════════════ */
.modal { overflow-x: hidden; }
.modal-body table { table-layout: fixed; word-break: break-word; }
.modal-body td, .modal-body th { overflow-wrap: break-word; word-break: break-word; }

@media (max-width: 768px) {
  .modal-body { padding: 18px 18px 22px; }
  .modal-head { padding: 20px 18px 0; }
}
@media (max-width: 480px) {
  .modal-body { padding: 14px 14px 18px; }
  .modal-head { padding: 16px 14px 0; }
  .modal-head h3 { font-size: 17px; }
}
@media (max-width: 390px) {
  .modal-body { padding: 10px 10px 14px; }
  .modal-head { padding: 12px 10px 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS CARD — compact padding + internal scroll for wide tables
   ══════════════════════════════════════════════════════════════════════════ */
.settings-card { overflow-x: auto; }

@media (max-width: 900px) {
  .settings-card { padding: 20px; }
}
@media (max-width: 640px) {
  .settings-card { padding: 16px; }
  .settings-grid { gap: 14px; }
}
@media (max-width: 480px) {
  .settings-card { padding: 14px; }
  .settings-grid { gap: 10px; }
}
@media (max-width: 390px) {
  .settings-card { padding: 10px; }
  .lang-btn { font-size: 13px; padding: 9px 14px; }
}
