:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #050505;
  --muted: #686868;
  --line: #deded9;
  --soft: #efefeb;
  --success: #14532d;
  --warning: #713f12;
  --danger: #7f1d1d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --sidebar: #050505;
  --sidebar-ink: #ffffff;
  --field: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #07111f;
  --panel: #0f1d31;
  --ink: #f8fafc;
  --muted: #9fb0c8;
  --line: #263850;
  --soft: #16263a;
  --success: #86efac;
  --warning: #facc15;
  --danger: #fca5a5;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --sidebar: #030916;
  --sidebar-ink: #f8fafc;
  --field: #101d2f;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Open Sans", "Myanmar Text", "Noto Sans Myanmar", Padauk, Pyidaungsu, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-lang="my"] body,
:root[data-lang="my"] button,
:root[data-lang="my"] input,
:root[data-lang="my"] select,
:root[data-lang="my"] textarea {
  font-family: "Open Sans", "Myanmar Text", "Noto Sans Myanmar", Padauk, Pyidaungsu, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  line-height: 1.25;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  overflow: hidden;
}

.shell.nav-collapsed {
  grid-template-columns: 92px minmax(0, 1fr);
}

.login-page {
  min-height: 100vh;
  display: grid;
  align-items: center;
  justify-items: end;
  padding: 24px clamp(24px, 7vw, 120px);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.7) 40%, rgba(5, 5, 5, 0.28) 100%),
    radial-gradient(circle at 50% 12%, rgba(21, 88, 166, 0.22), transparent 34%),
    url("./assets/login-bg-meeting-room.png") center / cover no-repeat;
}

:root[data-theme="dark"] .login-page {
  background:
    linear-gradient(115deg, rgba(3, 9, 22, 0.88) 0%, rgba(7, 17, 31, 0.78) 42%, rgba(0, 0, 0, 0.48) 100%),
    radial-gradient(circle at 50% 12%, rgba(30, 64, 175, 0.28), transparent 34%),
    url("./assets/login-bg-meeting-room.png") center / cover no-repeat;
}

.login-panel {
  width: min(540px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.18);
  padding: 40px;
  display: grid;
  gap: 28px;
  backdrop-filter: blur(12px);
}

:root[data-theme="dark"] .login-panel {
  background: rgba(15, 29, 49, 0.94);
  border-color: rgba(148, 163, 184, 0.28);
}

.login-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-page h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1;
}

.login-page p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.login-copy {
  display: grid;
  gap: 14px;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-help {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 6px;
}

.login-help span {
  color: var(--muted);
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
  padding: 5px;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  max-width: 170px;
}

.nav-collapsed .brand {
  justify-content: center;
}

.nav-collapsed .brand strong,
.nav-collapsed .brand span,
.nav-collapsed .switch-panel,
.nav-collapsed .profile-card div,
.nav-collapsed .profile .btn span {
  display: none;
}

.brand span,
.profile span,
.metric span,
.card p,
.table small {
  color: var(--muted);
}

.sidebar .brand span,
.sidebar .profile span {
  color: rgba(255, 255, 255, 0.62);
}

.login-brand .brand-logo {
  width: 98px;
  height: 78px;
  border-color: var(--line);
  border-radius: 18px;
}

.login-brand strong {
  max-width: 330px;
  font-size: 24px;
}

.nav {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav .nav-group-label {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
  width: 100%;
}

.nav .nav-group-label strong,
.nav button strong {
  display: flex;
  min-height: 100%;
  align-items: center;
  line-height: 1.25;
  transform: translateY(1px);
}

.nav .nav-group-label:hover,
.nav-group.active .nav-group-label {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-submenu {
  display: grid;
  gap: 6px;
  padding-left: 22px;
}

.nav-group:not(.open) .nav-submenu {
  display: none;
}

.nav-submenu button {
  min-height: 38px;
  grid-template-columns: 24px 1fr;
  font-size: 13px;
}

.sidebar-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-head .brand {
  min-width: 0;
}

.nav-collapse {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.nav-collapse:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 22px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.nav-collapse-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #fff;
}

.nav-collapse-icon .icon {
  width: 21px;
  height: 21px;
}

.nav-hover-tooltip {
  position: fixed;
  z-index: 80;
  max-width: min(240px, calc(100vw - 24px));
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: #050505;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.nav-hover-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

:root[data-theme="dark"] .nav-hover-tooltip {
  border-color: #46607f;
  background: #16263a;
  color: #f8fafc;
}

.nav button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.nav-icon em {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.nav-collapsed .nav button,
.nav-collapsed .nav-collapse,
.nav-collapsed .nav-group-label {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.nav-collapsed .sidebar-head {
  grid-template-columns: 1fr;
  justify-items: center;
}

.nav-collapsed .sidebar-head .nav-collapse {
  grid-row: 2;
  width: 42px;
  padding: 0;
}

.nav-collapsed .sidebar-head .brand {
  grid-row: 1;
}

.nav-collapsed .nav button strong,
.nav-collapsed .nav-group-label strong {
  display: none;
}

.nav-collapsed .nav-submenu {
  padding-left: 0;
}

.nav-collapsed .profile-card {
  grid-template-columns: 1fr;
  justify-items: center;
}

.nav-collapsed .profile .btn {
  width: 44px;
  padding: 0;
  justify-self: center;
  font-size: 0;
}

.nav-collapsed .profile .btn[data-action="logout"]::before {
  content: "L";
  font-size: 14px;
  font-weight: 900;
}

.nav-collapsed .profile .btn[data-action="install"]::before {
  content: "P";
  font-size: 14px;
  font-weight: 900;
}

.nav button.active,
.nav button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: #fff;
  color: #050505;
}

:root[data-theme="dark"] .nav button.active,
:root[data-theme="dark"] .nav button:hover {
  background: #eaf2ff;
  color: #06111f;
}

.profile {
  margin-top: auto;
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
  min-width: 0;
}

.switch-panel {
  display: grid;
  gap: 6px;
  padding-bottom: 4px;
  min-width: 0;
}

.switch-panel label {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.segmented.light {
  border-color: var(--line);
  background: var(--soft);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-block: 1px 0;
  line-height: 1.25;
}

.segmented button.active {
  background: #fff;
  color: #050505;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] .segmented button.active {
  background: #dbeafe;
  color: #06111f;
}

.profile-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.profile-card > div:last-child {
  min-width: 0;
}

.profile-card strong,
.profile-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #fff;
  color: #050505;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.main {
  min-width: 0;
  padding: 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-copy {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.topbar-heading {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.05;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.btn {
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  min-height: 42px;
  padding: 1px 14px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.25;
}

.btn.secondary {
  background: var(--panel);
  color: var(--ink);
}

.btn.ghost {
  background: transparent;
  color: inherit;
  border-color: var(--line);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.full {
  width: 100%;
}

:root[data-theme="dark"] .btn {
  background: #2563eb;
  border-color: #60a5fa;
  color: #f8fafc;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

:root[data-theme="dark"] .btn:hover {
  background: #1d4ed8;
  border-color: #93c5fd;
}

:root[data-theme="dark"] .btn.secondary {
  background: #16263a;
  border-color: #334b68;
  color: #eaf2ff;
  box-shadow: none;
}

:root[data-theme="dark"] .btn.ghost {
  background: transparent;
  border-color: #334b68;
  color: #eaf2ff;
  box-shadow: none;
}

:root[data-theme="dark"] .btn.secondary:hover,
:root[data-theme="dark"] .btn.ghost:hover {
  background: #1b2d45;
  border-color: #4b6381;
}

:root[data-theme="dark"] .btn.danger {
  background: #991b1b;
  border-color: #fca5a5;
  color: #fff;
}

.mobile-menu {
  display: none;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #050505;
  border-radius: 13px;
  background: #050505;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.mobile-menu:hover {
  transform: translateY(-1px);
  background: #202020;
}

:root[data-theme="dark"] .mobile-menu {
  border-color: #60a5fa;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.3);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  align-items: start;
}

.card,
.metric,
.modal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card,
.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 11px;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.password-control {
  position: relative;
  display: grid;
}

.password-control input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.password-toggle:hover {
  background: var(--soft);
  color: var(--ink);
}

.password-toggle .icon {
  width: 18px;
  height: 18px;
}

.time-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.time-control .btn {
  min-width: 58px;
}

.table-wrap {
  max-width: 100%;
  max-height: min(58vh, 620px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-record-list {
  display: none;
  gap: 12px;
}

.mobile-record-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  padding: 14px;
  display: grid;
  gap: 14px;
}

.mobile-record-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.mobile-record-header > div {
  min-width: 0;
}

.mobile-record-header h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.record-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.mobile-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mobile-record-grid > div {
  min-width: 0;
}

.mobile-record-grid span,
.mobile-record-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.mobile-record-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.mobile-record-grid strong {
  font-size: 13px;
  line-height: 1.4;
}

.mobile-record-grid .wide {
  grid-column: 1 / -1;
}

.mobile-record-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-record-actions.single {
  grid-template-columns: minmax(120px, 1fr);
}

.mobile-record-actions .btn {
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.status.approved {
  color: var(--success);
  background: #eef8f0;
}

:root[data-theme="dark"] .status.approved {
  background: rgba(22, 101, 52, 0.2);
}

.status.pending {
  color: var(--warning);
  background: #fff7e6;
}

:root[data-theme="dark"] .status.pending {
  background: rgba(250, 204, 21, 0.14);
}

.status.cancelled {
  color: var(--danger);
  background: #fff1f1;
}

.status.busy {
  color: var(--danger);
  background: #fff1f1;
  border-color: #fecaca;
}

:root[data-theme="dark"] .status.cancelled,
:root[data-theme="dark"] .status.busy {
  background: rgba(127, 29, 29, 0.2);
  border-color: rgba(252, 165, 165, 0.32);
}

.room-grid,
.user-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.room-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  padding: 18px;
  min-height: 150px;
  display: grid;
  gap: 16px;
  align-content: space-between;
}

.room-card h3 {
  margin: 0 0 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--soft);
  min-height: 27px;
  padding: 4px 8px;
  font-size: 12px;
}

.busy-slots {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.busy-slots > strong {
  color: var(--danger);
  font-size: 12px;
  text-transform: uppercase;
}

.busy-slot {
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  border-radius: 12px;
  background: #fff1f1;
  color: var(--danger);
  padding: 8px 10px;
}

:root[data-theme="dark"] .busy-slot {
  background: rgba(127, 29, 29, 0.24);
  border-color: rgba(252, 165, 165, 0.34);
}

.busy-slot span,
.busy-slot small {
  display: block;
}

.busy-slot span {
  font-weight: 800;
}

.busy-slot small {
  margin-top: 2px;
  color: #991b1b;
}

:root[data-theme="dark"] .busy-slot small {
  color: #fecaca;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn.compact {
  min-height: 34px;
  padding: 0 10px;
}

.department-users {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

.department-user {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
}

.department-user strong,
.department-user span {
  display: block;
}

.department-user span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.department-user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.department-user.empty-row {
  display: flex;
  color: var(--muted);
  border-style: dashed;
}

.permission-grid {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) repeat(var(--role-count, 3), minmax(84px, 0.5fr));
  gap: 8px;
  align-items: center;
  margin: 14px 0 18px;
  overflow-x: auto;
}

.permission-grid > strong {
  padding: 10px;
  border-radius: 12px;
  background: var(--field);
}

.permission-check {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
}

.permission-check input {
  width: 18px;
  height: 18px;
}

.role-list {
  display: grid;
  gap: 10px;
}

.role-row {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.role-row strong,
.role-row span {
  display: block;
}

.role-row span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.notification-grid {
  display: grid;
  gap: 12px;
  max-width: 860px;
}

.notification-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}

.notification-card:hover {
  border-color: #60a5fa;
}

.notification-card.unread {
  border-color: rgba(37, 99, 235, 0.45);
}

.notification-card.read {
  opacity: 0.68;
}

.notification-card.reminder {
  border-color: #facc15;
}

.notification-card.success {
  border-color: rgba(20, 83, 45, 0.28);
}

.notification-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--soft);
}

.notification-card p {
  margin: 4px 0;
  color: var(--muted);
}

.notification-card span {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 30;
}

.modal.open {
  display: flex;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 20px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: stretch;
  height: calc(100dvh - 166px);
  min-height: 0;
}

.calendar-shell,
.day-panel {
  min-height: 0;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.day-panel {
  padding: 18px;
  overflow: hidden;
  position: static;
  display: flex;
  flex-direction: column;
}

.calendar-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.calendar-toolbar > div:first-child {
  display: grid;
  gap: 6px;
}

.calendar-view-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
}

.calendar-view-switch button {
  border: 0;
  border-radius: 10px;
  min-height: 36px;
  padding: 1px 12px 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar-view-switch button.active {
  background: var(--soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.actions.no-margin {
  margin-top: 0;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays span {
  padding: 10px;
  background: var(--soft);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-cell {
  min-height: 132px;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  text-align: left;
  border-top: 0;
  border-left: 0;
  cursor: pointer;
}

.calendar-cell.muted {
  background: var(--soft);
  color: var(--muted);
}

.calendar-cell.today {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.calendar-cell.selected {
  box-shadow: inset 0 0 0 3px #2563eb;
}

:root[data-theme="dark"] .calendar-cell.selected {
  box-shadow: inset 0 0 0 3px #93c5fd;
}

.calendar-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.calendar-cell-events {
  display: grid;
  gap: 5px;
}

.calendar-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 6px;
  background: var(--soft);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.calendar-pill:hover,
.day-slot-booking:hover {
  outline: 1px dashed #60a5fa;
  outline-offset: 2px;
}

.calendar-pill strong,
.calendar-pill span {
  display: block;
}

.calendar-pill span {
  color: var(--muted);
}

.calendar-pill.approved {
  background: #eef8f0;
  color: var(--success);
}

:root[data-theme="dark"] .calendar-pill.approved {
  background: rgba(22, 101, 52, 0.2);
}

.calendar-pill.pending {
  background: #fff7e6;
  color: var(--warning);
}

:root[data-theme="dark"] .calendar-pill.pending {
  background: rgba(250, 204, 21, 0.14);
}

.calendar-pill.cancelled {
  background: #fff1f1;
  color: var(--danger);
}

:root[data-theme="dark"] .calendar-pill.cancelled {
  background: rgba(127, 29, 29, 0.2);
}

.day-panel p {
  color: var(--muted);
  margin: -4px 0 14px;
}

.calendar-agenda.single {
  padding: 14px;
}

.agenda-day-title {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 900;
  font-size: 18px;
}

.workweek-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  min-height: 520px;
  overflow-x: auto;
}

.workweek-day {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--field);
  cursor: pointer;
}

.workweek-day.selected {
  box-shadow: inset 0 0 0 3px #2563eb;
}

:root[data-theme="dark"] .workweek-day.selected {
  box-shadow: inset 0 0 0 3px #93c5fd;
}

.workweek-events {
  display: grid;
  align-content: start;
  gap: 8px;
  color: var(--muted);
}

.day-timeline {
  display: grid;
  min-height: 0;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

.day-slot {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  cursor: default;
}

.day-slot > strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.day-slot > div {
  min-width: 0;
}

.day-slot.free {
  cursor: pointer;
}

.day-slot.free {
  border-color: rgba(20, 83, 45, 0.24);
}

.day-slot.busy {
  border-color: #fecaca;
  background: #fff1f1;
}

:root[data-theme="dark"] .day-slot.busy {
  background: rgba(127, 29, 29, 0.2);
  border-color: rgba(252, 165, 165, 0.34);
}

.day-slot span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.day-slot-booking {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 12px;
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.booking-detail {
  display: grid;
  gap: 14px;
}

.detail-accent {
  height: 5px;
  margin: -20px -20px 4px;
  border-radius: 14px 14px 0 0;
  background: #2563eb;
}

.detail-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row strong,
.detail-row span {
  display: block;
}

.detail-row span {
  color: var(--muted);
  margin-top: 4px;
}

.detail-actions {
  justify-content: flex-end;
}

.alert-modal {
  z-index: 60;
}

.alert-panel {
  width: min(440px, 100%);
}

.alert-panel.danger {
  border-color: #fecaca;
  box-shadow: 0 22px 70px rgba(127, 29, 29, 0.18);
}

.alert-panel.danger h2 {
  color: var(--danger);
}

.alert-panel.danger .btn.full {
  background: var(--danger);
  border-color: var(--danger);
}

.alert-panel.success {
  border-color: #86efac;
  box-shadow: 0 22px 70px rgba(21, 128, 61, 0.18);
}

.alert-panel.success h2 {
  color: #15803d;
}

.alert-panel.success .btn.full {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

body[data-theme="dark"] .alert-panel.success {
  border-color: rgba(74, 222, 128, 0.6);
  box-shadow: 0 22px 70px rgba(34, 197, 94, 0.18);
}

body[data-theme="dark"] .alert-panel.success h2 {
  color: #86efac;
}

.alert-panel p {
  color: var(--muted);
  margin: 0 0 14px;
}

.confirm-actions {
  justify-content: flex-end;
}

.alert-detail {
  display: grid;
  gap: 6px;
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.alert-detail span {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #050505;
  color: #fff;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  transform: translateY(120px);
  transition: transform 0.2s ease;
  z-index: 40;
}

.toast.show {
  transform: translateY(0);
}

.display-page {
  min-height: 100vh;
  padding: 28px;
  background: var(--bg);
}

.display-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  gap: 18px;
  align-content: start;
}

.display-header,
.display-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.display-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.display-toolbar h1 {
  margin: 8px 0 4px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
}

.display-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.display-toolbar .field {
  width: min(360px, 100%);
}

.display-status {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.display-status.free {
  background: #ecfdf5;
  border-color: #86efac;
  color: #14532d;
}

.display-status.busy {
  background: #fff1f1;
  border-color: #fca5a5;
  color: #7f1d1d;
}

:root[data-theme="dark"] .display-status.free {
  background: rgba(22, 101, 52, 0.24);
}

:root[data-theme="dark"] .display-status.busy {
  background: rgba(127, 29, 29, 0.28);
}

.display-status span {
  font-weight: 900;
  text-transform: uppercase;
}

.display-status strong {
  display: block;
  font-size: clamp(46px, 7vw, 96px);
  line-height: 1;
  margin: 8px 0;
}

.display-status p {
  margin: 0;
  font-size: 22px;
}

.display-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  min-height: 0;
}

.display-card {
  display: flex;
  flex-direction: column;
  max-height: min(48vh, 560px);
  min-height: 300px;
  overflow: hidden;
}

.display-card .section-title {
  flex: 0 0 auto;
}

.display-scroll {
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.display-scroll::-webkit-scrollbar {
  width: 10px;
}

.display-scroll::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.42);
  border-radius: 999px;
}

.display-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.display-booking,
.display-slot {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--field);
}

.display-booking + .display-booking,
.display-slot + .display-slot {
  margin-top: 10px;
}

.display-booking strong,
.display-booking span,
.display-booking small {
  display: block;
}

.display-booking strong {
  font-size: 22px;
}

.display-booking small {
  color: var(--muted);
  margin-top: 4px;
}

.display-timeline {
  display: grid;
  gap: 10px;
}

.display-slot {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 14px;
}

.display-slot.free {
  border-color: #86efac;
}

.display-slot.busy {
  border-color: #fca5a5;
  background: #fff1f1;
  color: #7f1d1d;
}

:root[data-theme="dark"] .display-slot.busy {
  background: rgba(127, 29, 29, 0.24);
}

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .shell.nav-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .main {
    padding: 18px;
  }

  .sidebar {
    padding: 14px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .brand strong {
    font-size: 13px;
    max-width: 145px;
  }

  .nav button,
  .nav-collapse,
  .nav .nav-group-label {
    min-height: 40px;
    gap: 8px;
    padding: 0 10px;
  }

  .nav-collapsed .nav button,
  .nav-collapsed .nav-collapse,
  .nav-collapsed .nav-group-label {
    padding: 0;
  }

  .nav-collapsed .brand-logo {
    width: 44px;
    height: 44px;
  }

  .nav-collapsed .sidebar {
    padding-inline: 10px;
  }

  .segmented button {
    padding: 0 8px;
    min-width: 0;
    font-size: 12px;
  }

  .grid.metrics,
  .filters,
  .calendar-layout,
  .display-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .room-card {
    padding: 14px;
  }

  .table-wrap {
    max-height: 44vh;
  }
}

@media (max-width: 900px) {
  .desktop-record-table {
    display: none;
  }

  .mobile-record-list {
    display: grid;
    max-height: 58vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 4px;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  .shell:not(.nav-collapsed) {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .shell.nav-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .calendar-layout {
    height: calc(100dvh - 224px);
  }
}

@media (max-width: 760px) {
  .nav-hover-tooltip {
    display: none;
  }

  .login-page {
    justify-items: center;
    padding: 18px;
  }

  .login-panel {
    padding: 26px;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: min(300px, 82vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }

  .shell.nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    padding: 18px;
    min-width: 0;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .topbar-copy {
    width: 100%;
    gap: 14px;
  }

  .grid.two,
  .room-grid,
  .user-grid,
  .form-grid,
  .calendar-layout,
  .display-grid {
    grid-template-columns: 1fr;
  }

  .calendar-layout {
    height: auto;
  }

  .calendar-shell,
  .day-panel {
    height: auto;
  }

  .day-panel {
    max-height: 66dvh;
  }

  .shell.nav-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .shell.nav-collapsed .sidebar {
    position: sticky;
    width: auto;
    min-width: 0;
    transform: none;
    padding-inline: 10px;
  }

  .shell.nav-collapsed .main {
    grid-column: 2;
  }

  .display-page {
    padding: 16px;
  }

  .display-card {
    max-height: 52vh;
    min-height: 260px;
  }

  .display-header,
  .display-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .department-user {
    grid-template-columns: 1fr;
  }

  .grid.metrics,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.metrics {
    gap: 10px;
  }

  .grid.metrics .metric {
    min-height: 132px;
    padding: 14px;
  }

  .grid.metrics .metric strong {
    font-size: 26px;
  }

  .department-users {
    max-height: 230px;
  }

  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workweek-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .workweek-day {
    min-height: 160px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .calendar-cell {
    min-height: 118px;
  }

  .permission-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: 58vh;
  }

  .role-row {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .shell,
  .shell.nav-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .shell.nav-collapsed .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    width: min(310px, 86vw);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding: 16px;
    overflow-y: auto;
  }

  .shell.nav-open .sidebar,
  .shell.nav-open.nav-collapsed .sidebar {
    transform: translateX(0);
  }

  .shell.nav-collapsed .main {
    grid-column: auto;
  }

  .sidebar-head,
  .shell.nav-collapsed .sidebar-head {
    grid-template-columns: 42px minmax(0, 1fr);
    justify-items: stretch;
  }

  .sidebar-head .nav-collapse,
  .shell.nav-collapsed .sidebar-head .nav-collapse {
    grid-row: 1;
    width: 42px;
    padding: 0;
    justify-items: center;
  }

  .sidebar-head .brand,
  .shell.nav-collapsed .sidebar-head .brand {
    grid-row: 1;
    grid-column: 2;
  }

  .shell.nav-collapsed .brand {
    justify-content: flex-start;
  }

  .shell.nav-collapsed .brand strong,
  .shell.nav-collapsed .brand span,
  .shell.nav-collapsed .switch-panel,
  .shell.nav-collapsed .profile-card div,
  .shell.nav-collapsed .profile .btn span,
  .shell.nav-collapsed .nav button strong,
  .shell.nav-collapsed .nav-group-label strong {
    display: block;
  }

  .shell.nav-collapsed .nav button,
  .shell.nav-collapsed .nav-collapse,
  .shell.nav-collapsed .nav-group-label {
    grid-template-columns: 28px 1fr;
    justify-items: stretch;
    padding: 0 12px;
  }

  .shell.nav-collapsed .profile-card {
    grid-template-columns: 38px 1fr;
    justify-items: stretch;
  }

  .shell.nav-collapsed .profile .btn {
    width: 100%;
    padding: 0 14px;
    justify-self: stretch;
    font-size: 14px;
  }

  .shell.nav-collapsed .profile .btn[data-action="logout"]::before,
  .shell.nav-collapsed .profile .btn[data-action="install"]::before {
    content: none;
  }

  .topbar h1 {
    font-size: 32px;
  }

  .main {
    padding: 14px;
  }

  .card,
  .metric {
    padding: 14px;
  }

  .table-wrap {
    max-height: 62vh;
  }

  table {
    min-width: 720px;
  }
}
