/* ============================================================
   Crew Desk Redesign — Design Tokens + Shared Components
   Replaces portal.css and phase4.css
   ============================================================ */

/* ---------- 1. CSS Custom Properties (Design Tokens) ---------- */

:root {
  /* Backgrounds */
  --bg:          #050b1c;
  --sidebar:     #07102a;
  --topbar:      #060d24;
  --surface:     #0b1531;
  --surface-2:   #0f1a3c;
  --input-bg:    #0e1a3d;
  --table-head:  #0e1838;

  /* Borders */
  --border:       #1c2a52;
  --border-input: #24335f;
  --border-light: #16224a;

  /* Gold accent */
  --gold:         #d4b07a;
  --gold-text:    #e6c48d;
  --gold-border:  #6b5631;
  --gold-dark:    #1a1407;

  /* Text */
  --text:        #e9edf7;
  --text-muted:  #9aa6c7;
  --text-body:   #c3cbe0;
  --table-label: #c9a873;

  /* Status chip: green */
  --green:       #7fd1a8;
  --green-bg:    #0f2a22;
  --green-bdr:   #1f5a44;

  /* Status chip: amber */
  --amber:       #e9b65c;
  --amber-bg:    #2c2210;
  --amber-bdr:   #5a4318;

  /* Status chip: red */
  --red:         #f0968a;
  --red-bg:      #2d1517;
  --red-bdr:     #6a2e2c;

  /* Status chip: blue */
  --blue:        #8fb4f0;
  --blue-bg:     #122244;
  --blue-bdr:    #2a4a85;

  /* Status chip: gray */
  --gray:        #b9c2da;
  --gray-bg:     #18213f;
  --gray-bdr:    #2c3a66;

  /* Component tokens */
  --nav-active-bg: #1a2140;
  --toggle-bg:     #1f2b55;
  --badge-bg:      #1f2b55;
  --kpi-border:    #22305a;

  /* Shape */
  --radius-card:  16px;
  --radius-btn:   10px;
  --radius-input: 10px;
  --radius-chip:  999px;
  --radius-kpi:   12px;
  --radius-tw:    12px;

  /* Sizing */
  --min-h-btn:   44px;
  --min-h-input: 44px;
  --min-h-sm:    36px;

  /* Spacing */
  --page-pad:    32px;
  --card-pad:    24px;
  --max-w:       1200px;

  /* Typography */
  --font:        'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-display:'Cormorant Garamond', Georgia, serif;

  /* Shadows */
  --shadow-menu: 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-fab:  0 8px 20px rgba(0, 0, 0, 0.5);
  --shadow-modal:0 24px 60px rgba(0, 0, 0, 0.55);
}


/* ---------- 2. Base Reset ---------- */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover {
  color: var(--gold-text);
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
}


/* ---------- 3. Typography ---------- */

.h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text);
}

.h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.sub {
  font-size: 14px;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


/* ---------- 4. Layout Utilities ---------- */

.main {
  padding: var(--page-pad);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--max-w);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.btw {
  justify-content: space-between;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}


/* ---------- 5. Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  box-sizing: border-box;
}


/* ---------- 6. Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--min-h-btn);
  padding: 0 18px;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.88;
}

.btn:active {
  opacity: 0.75;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Primary — gold */
.bp {
  background: var(--gold);
  color: var(--gold-dark);
  border: none;
}

/* Secondary — gold outline */
.bs {
  background: transparent;
  color: var(--gold-text);
  border: 1px solid var(--gold-border);
}

/* Quiet — subtle outline */
.bq {
  background: transparent;
  color: var(--text-body);
  border: 1px solid var(--border-input);
}

/* Small variant */
.sm {
  min-height: var(--min-h-sm);
  padding: 0 12px;
  font-size: 13px;
}


/* ---------- 7. Chips / Badges ---------- */

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-chip);
  padding: 4px 10px;
  border: 1px solid;
  white-space: nowrap;
}

.c-gray {
  color: var(--gray);
  background: var(--gray-bg);
  border-color: var(--gray-bdr);
}

.c-amber {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: var(--amber-bdr);
}

.c-green {
  color: var(--green);
  background: var(--green-bg);
  border-color: var(--green-bdr);
}

.c-blue {
  color: var(--blue);
  background: var(--blue-bg);
  border-color: var(--blue-bdr);
}

.c-red {
  color: var(--red);
  background: var(--red-bg);
  border-color: var(--red-bdr);
}

/* Tab badge / counter */
.cnt {
  font-size: 11px;
  font-weight: 700;
  background: var(--badge-bg);
  color: var(--gold-text);
  border-radius: var(--radius-chip);
  padding: 1px 7px;
  margin-left: 6px;
}


/* ---------- 8. Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.tab {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  cursor: pointer;
  min-height: var(--min-h-btn);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--text-body);
}

.tab.on {
  color: var(--gold-text);
  border-bottom-color: var(--gold);
  font-weight: 600;
}


/* ---------- 9. Tables ---------- */

.tw {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-tw);
}

.tbl {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}

.tbl th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--table-label);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  background: var(--table-head);
  white-space: nowrap;
}

.tbl td {
  padding: 12px 16px;
  border-top: 1px solid #1a2750;
  vertical-align: middle;
}

.tbl tbody tr:hover {
  background: rgba(31, 43, 85, 0.3);
}


/* ---------- 10. Form Inputs ---------- */

.in {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 0 12px;
  min-height: var(--min-h-input);
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
  width: 100%;
  transition: border-color 0.15s ease;
}

.in:focus {
  outline: none;
  border-color: var(--gold);
}

.in::placeholder {
  color: var(--text-muted);
}

textarea.in {
  padding: 10px 12px;
  min-height: 70px;
  resize: vertical;
}

select.in {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa6c7' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.lbl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex: 1 1 180px;
}

/* Checkbox accent */
input[type="checkbox"] {
  accent-color: var(--gold);
}


/* ---------- 11. KPI Tiles ---------- */

.kpi {
  background: var(--surface-2);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-kpi);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
}

.kpi b {
  font-size: 24px;
  font-weight: 600;
}

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


/* ---------- 12. Avatars ---------- */

.av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--toggle-bg);
  color: var(--gold-text);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}


/* ---------- 13. User Row ---------- */

.who {
  display: flex;
  align-items: center;
  gap: 10px;
}

.who small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}


/* ---------- 14. Toggle Switch ---------- */

.toggle {
  display: inline-flex;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-chip);
  padding: 3px;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.2s ease;
  border: none;
}

.toggle[aria-checked="false"],
.toggle.off {
  background: var(--border-input);
  justify-content: flex-start;
}

.toggle[aria-checked="true"],
.toggle.on {
  background: var(--gold);
  justify-content: flex-end;
}

.toggle-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold-dark);
}


/* ---------- 15. Scrollbar ---------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-input);
}


/* ---------- 16. App Shell Layout ---------- */

.app-shell {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.app-sidebar {
  flex: 1 1 240px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--border-light);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.app-content {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border-light);
  background: var(--topbar);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}


/* ---------- 17. Sidebar Navigation ---------- */

.sidebar-brand {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-section {
  padding: 16px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 2px 10px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  color: var(--text-body);
  text-decoration: none;
  transition: background 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(31, 43, 85, 0.4);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--nav-active-bg);
  color: var(--gold-text);
  font-weight: 600;
}

.sidebar-link .cnt {
  margin-left: auto;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
}


/* ---------- 18. Top Bar Components ---------- */

.topbar-company {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 0 14px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 0 14px;
  min-height: 40px;
  min-width: 200px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}

.topbar-search kbd {
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: auto;
}

.topbar-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  color: var(--text-body);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topbar-icon-btn:hover {
  background: var(--toggle-bg);
}

.topbar-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold);
  color: var(--gold-dark);
  border-radius: var(--radius-chip);
  padding: 1px 5px;
  line-height: 1.3;
}


/* ---------- 19. Overlays & Modals ---------- */

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  box-shadow: var(--shadow-modal);
  max-width: 640px;
  width: 100%;
}

.dropdown-menu {
  background: #0c1736;
  border: 1px solid #2a3a6a;
  border-radius: var(--radius-kpi);
  box-shadow: var(--shadow-menu);
  padding: 6px;
  display: flex;
  flex-direction: column;
  z-index: 60;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.dropdown-item:hover {
  background: rgba(31, 43, 85, 0.5);
}

.dropdown-item.danger {
  color: var(--red);
}


/* ---------- 20. Notification Panel ---------- */

.notification-panel {
  width: 380px;
  max-height: 520px;
  overflow-y: auto;
  background: #0c1736;
  border: 1px solid #2a3a6a;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-menu);
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-item.unread {
  background: rgba(31, 43, 85, 0.3);
}


/* ---------- 20b. Account Menu & Notification Icon ---------- */

.notification-menu {
  position: relative;
}

.notification-icon {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  color: var(--text-body);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.notification-icon:hover {
  background: var(--toggle-bg);
}

#notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold);
  color: var(--gold-dark);
  border-radius: var(--radius-chip);
  padding: 1px 5px;
  line-height: 1.3;
}

#notification-count:empty,
#notification-count[data-count="0"] {
  display: none;
}

.notification-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
}

.account-menu {
  position: relative;
}

.account-menu > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  padding: 4px 12px 4px 4px;
  min-height: var(--min-h-btn);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu > summary:hover {
  border-color: var(--gold-border);
}

.account-menu .avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.account-menu .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-menu .avatar-initials {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--toggle-bg);
  color: var(--gold-text);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.identity-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.identity-role {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.25;
}

.account-options {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 200;
  background: #0c1736;
  border: 1px solid #2a3a6a;
  border-radius: var(--radius-kpi);
  box-shadow: var(--shadow-menu);
  padding: 6px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

.account-options button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-body);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.account-options button:hover {
  background: rgba(31, 43, 85, 0.5);
  color: var(--text);
}

/* ---------- 21. Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-kpi);
  padding: 14px 18px;
  box-shadow: var(--shadow-menu);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ---------- 22. Progress Bar ---------- */

.progress-track {
  height: 6px;
  background: #18234a;
  border-radius: var(--radius-chip);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: var(--radius-chip);
  transition: width 0.3s ease;
}


/* ---------- 23. Sticky Save Bar ---------- */

.save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
}

.save-bar .muted {
  margin-right: auto;
  font-size: 13px;
}


/* ---------- 24. Pagination ---------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}


/* ---------- 25. View Toggle ---------- */

.view-toggle {
  display: flex;
  background: #0b1534;
  border: 1px solid var(--border-input);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.view-toggle-btn {
  background: transparent;
  color: var(--text-body);
  border: none;
  border-radius: 9px;
  padding: 0 16px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.view-toggle-btn[aria-pressed="true"],
.view-toggle-btn.on {
  background: var(--toggle-bg);
  color: var(--gold-text);
  font-weight: 600;
}


/* ---------- 26. Mobile — Bottom Tab Bar ---------- */

@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }

  .app-topbar {
    padding: 14px 18px;
  }

  .main {
    padding: 18px;
  }

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

  .tbl {
    min-width: unset;
  }
}

.mobile-tabbar {
  display: none;
  background: var(--sidebar);
  border-top: 1px solid var(--border-light);
  padding: 4px 6px 14px;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
}

.mobile-tab.active {
  color: var(--gold-text);
  font-weight: 600;
}

.mobile-fab {
  width: 56px;
  height: 56px;
  margin-top: -26px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow-fab);
  border: 4px solid var(--sidebar);
}

@media (max-width: 768px) {
  .mobile-tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
  }

  .app-content {
    padding-bottom: 70px;
  }
}


/* ---------- 27. Chat ---------- */

.chat-bubble-sent {
  background: var(--gold);
  color: var(--gold-dark);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  max-width: 340px;
  font-size: 14px;
  line-height: 1.45;
}

.chat-bubble-recv {
  background: #13204a;
  color: var(--text);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  max-width: 340px;
  font-size: 14px;
  line-height: 1.45;
}

.chat-date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 16px 0;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.chat-new-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-text);
  margin: 12px 0;
}

.chat-new-divider::before,
.chat-new-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--gold-border);
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--sidebar);
}

.chat-input {
  flex: 1;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-input);
  border-radius: 20px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  min-height: 42px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--gold);
}

.chat-online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--sidebar);
  position: absolute;
  bottom: 0;
  right: 0;
}


/* ---------- 28. Floating Chat Window ---------- */

.chat-window {
  width: 340px;
  height: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: var(--shadow-menu);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-window-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
}

.chat-window-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* ---------- 29. Settings Sub-Nav ---------- */

.settings-nav {
  flex: 1 1 220px;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  color: var(--text-body);
  text-decoration: none;
  transition: background 0.15s ease;
}

.settings-nav-link:hover {
  background: rgba(31, 43, 85, 0.4);
}

.settings-nav-link.active {
  background: var(--nav-active-bg);
  color: var(--gold-text);
  font-weight: 600;
}


/* ---------- 30. Day-of-Week Toggle ---------- */

.day-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 44px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.day-toggle.on {
  background: var(--toggle-bg);
  color: var(--gold-text);
  border: 1px solid var(--gold-border);
  font-weight: 600;
}

.day-toggle.off {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-input);
}


/* ---------- 31. File Attachment Card ---------- */

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 13px;
}

.file-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--green-bg);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}


/* ---------- 32. Bulk Action Bar ---------- */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--toggle-bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  font-size: 14px;
}


/* ---------- 33. Dashboard ─ Greeting ---------- */

.dash-greeting {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.dash-greeting h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
.dash-greeting .dash-date {
  font-size: 15px;
  color: var(--muted);
}
.dash-view-toggle {
  display: flex;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.dash-view-toggle button {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 9px;
  padding: 0 16px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.dash-view-toggle button[aria-pressed="true"] {
  background: #1f2b55;
  color: var(--gold);
  font-weight: 600;
}


/* ---------- 34. Dashboard ─ Card Grid ---------- */

.dash-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.dash-row-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .dash-row-2 { grid-template-columns: 1fr; }
}
.dash-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.dash-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.dash-card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
}
.dash-card-link:hover { color: #ecd3a6; }


/* ---------- 35. Dashboard ─ Today Card ---------- */

.dash-big-number {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.dash-big-sub {
  font-size: 13px;
  color: var(--muted);
}
.dash-today-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-today-actions label {
  flex: 1 1 120px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.dash-today-actions select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  padding: 0 12px;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
}
.dash-today-actions .btn-primary {
  flex: 1 1 120px;
  align-self: flex-end;
}


/* ---------- 36. Dashboard ─ Progress Bars ---------- */

.dash-progress-track {
  height: 8px;
  background: #18234a;
  border-radius: 999px;
  overflow: hidden;
}
.dash-progress-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
  transition: width .4s ease;
}
.dash-progress-bar.blue { background: #7fa6e8; }
.dash-progress-bar.green { background: var(--green); }
.dash-progress-track.thin { height: 6px; }


/* ---------- 37. Dashboard ─ Week Grid ---------- */

.dash-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.dash-week-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-week-cell .day-block {
  height: 36px;
  border-radius: 6px;
  background: #121b3c;
}
.dash-week-cell .day-block.today {
  background: #18234a;
  border: 1px solid var(--gold);
  box-sizing: border-box;
}
.dash-week-cell .day-block.weekend {
  background: #0d1531;
}
.dash-week-cell .day-block.filled {
  background: var(--gold);
  opacity: 0.5;
}
.dash-week-cell .day-block.filled.today {
  opacity: 1;
}
.dash-week-cell .day-label {
  color: var(--muted);
}
.dash-week-cell .day-label.today {
  color: var(--gold);
  font-weight: 600;
}


/* ---------- 38. Dashboard ─ Leave Balance ---------- */

.dash-leave-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-leave-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.dash-leave-header .leave-detail {
  color: var(--muted);
}
.dash-leave-note {
  font-size: 12px;
  color: #8f9cc0;
}


/* ---------- 39. Dashboard ─ Task Counts ---------- */

.dash-task-counts {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.dash-task-counts strong { color: var(--text); }
.dash-task-counts .overdue { color: #e9b65c; }
.dash-empty-state {
  border: 1px dashed #26355f;
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.dash-empty-state svg { color: #6f7ea8; }
.dash-empty-state .empty-title {
  font-size: 15px;
  font-weight: 500;
}
.dash-empty-state .empty-sub {
  font-size: 13px;
  color: var(--muted);
}


/* ---------- 40. Dashboard ─ Holiday Tiles ---------- */

.dash-holiday-tile {
  display: flex;
  gap: 14px;
  align-items: center;
}
.dash-holiday-date {
  width: 52px;
  height: 56px;
  border-radius: 10px;
  background: #18213f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-holiday-date .month {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
}
.dash-holiday-date .day {
  font-size: 20px;
  font-weight: 600;
}
.dash-holiday-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-holiday-info .name {
  font-size: 14px;
  font-weight: 600;
}
.dash-holiday-info .range {
  font-size: 13px;
  color: var(--muted);
}


/* ---------- 41. Dashboard ─ Team Today ---------- */

.dash-team-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.dash-team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-team-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.dash-team-header .team-sub {
  font-size: 13px;
  color: var(--muted);
}
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.dash-kpi {
  background: #0f1a3c;
  border: 1px solid #22305a;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.dash-kpi:hover { border-color: var(--border-input); }
.dash-kpi .kpi-label {
  font-size: 12px;
  color: var(--muted);
}
.dash-kpi .kpi-value {
  font-size: 24px;
  font-weight: 600;
}
.dash-kpi .kpi-total {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}
.dash-kpi.warn {
  background: #2a1f0e;
  border-color: #6a4d1c;
}
.dash-kpi.warn .kpi-label {
  color: #e9b65c;
  font-weight: 600;
}
.dash-kpi.warn .kpi-total {
  color: #c9a873;
}

.dash-attention-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-attention-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.dash-attention-table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.dash-attention-table table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}
.dash-attention-table thead tr {
  background: #0e1838;
  text-align: left;
}
.dash-attention-table th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #c9a873;
  letter-spacing: 0.6px;
}
.dash-attention-table td {
  padding: 12px 16px;
  border-top: 1px solid #1a2750;
}
.dash-attention-table .employee-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-attention-table .avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1f2d5a;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-attention-table .emp-name {
  font-weight: 500;
}
.dash-attention-table .emp-role {
  font-size: 12px;
  color: var(--muted);
}
.dash-attention-table .remind-btn {
  background: transparent;
  color: var(--gold);
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}
.dash-attention-table .remind-btn:hover { color: #ecd3a6; }

.btn-outline-gold {
  background: transparent;
  color: var(--gold);
  border: 1px solid #6b5631;
  border-radius: var(--radius-btn);
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 16px;
}
.btn-outline-gold:hover {
  border-color: var(--gold);
  color: #ecd3a6;
}
.btn-outline-gold.sm {
  min-height: 40px;
  font-size: 13px;
}

/* ── 42  Page Head ─────────────────────────────────────── */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.page-head p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 4px 0 0;
}
.page-title {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text);
}
.page-head .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── 43  Panel (card sections) ─────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.panel .note {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
  line-height: 1.5;
}
.panel .note a {
  color: var(--gold-text);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── 44  Stats row ─────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.stat {
  background: var(--bg-kpi);
  border: 1px solid var(--border-kpi);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
}
.stat-value small {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── 45  Table ─────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table,
table:not(.tbl) {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}
.table-wrap th,
table:not(.tbl) th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-dim);
  letter-spacing: 0.6px;
  background: #0e1838;
  white-space: nowrap;
}
.table-wrap td,
table:not(.tbl) td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-row);
  vertical-align: middle;
  color: var(--text);
}
.table-wrap tbody tr:hover,
table:not(.tbl) tbody tr:hover {
  background: rgba(212, 176, 122, 0.03);
}
.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── 46  Badge ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.3;
}
.badge.Draft,
.badge.Pending,
.badge.Queued,
.badge.Missing,
.badge.Notcheckedin,
.badge.Retry {
  color: #e9b65c;
  background: #2c2210;
  border-color: #5a4318;
}
.badge.Approved,
.badge.Active,
.badge.Checkedout,
.badge.Ontime,
.badge.Working,
.badge.Confirmed,
.badge.Done,
.badge.Accepted,
.badge.Present {
  color: #7fd1a8;
  background: #0f2a22;
  border-color: #1f5a44;
}
.badge.Submitted,
.badge.Remote,
.badge.Onbreak,
.badge.New,
.badge.Open {
  color: #8fb4f0;
  background: #122244;
  border-color: #2a4a85;
}
.badge.Returned,
.badge.Rejected,
.badge.Failed,
.badge.Late,
.badge.Overdue,
.badge.Absent,
.badge.Archived {
  color: #f0968a;
  background: #2d1517;
  border-color: #6a2e2c;
}
.badge.Read,
.badge.Onleave,
.badge.Cancelled {
  color: #b9c2da;
  background: #18213f;
  border-color: #2c3a66;
}

/* ── 47  Form fields ───────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 20px;
}
label,
fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
}
fieldset legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 6px;
}
fieldset label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="file"],
select,
textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  padding: 0 12px;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
  width: 100%;
}
textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 176, 122, 0.15);
}
input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  min-height: auto;
}

/* ── 48  Section tabs ──────────────────────────────────── */
.section-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.section-tabs button {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  transition: color 0.15s, border-color 0.15s;
}
.section-tabs button:hover {
  color: var(--text);
}
.section-tabs button.active,
.section-tabs button[aria-selected="true"] {
  color: var(--gold-text);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* ── 49  Buttons (generic) ─────────────────────────────── */
button,
.actions button,
.panel button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
button:hover {
  border-color: var(--gold-dim);
  color: var(--gold-text);
}
button[type="submit"],
.actions button:first-child:not(.secondary):not(.text-button):not([data-go]),
.page-head .actions button:first-child {
  background: var(--gold);
  color: #1a1407;
  border-color: var(--gold);
}
button[type="submit"]:hover,
.actions button:first-child:not(.secondary):not(.text-button):not([data-go]):hover {
  background: var(--gold-hover);
}
button.secondary {
  background: transparent;
  color: var(--gold-text);
  border: 1px solid #6b5631;
}
button.secondary:hover {
  border-color: var(--gold);
}
button.danger {
  color: #f0968a;
  border-color: #6a2e2c;
}
button.danger:hover {
  background: #2d1517;
}
button.text-button {
  background: transparent;
  border: none;
  padding: 0;
  min-height: auto;
  color: var(--gold-text);
  font-weight: 500;
  font-size: 13px;
}
button.text-button:hover {
  color: #ecd3a6;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── 50  Filters row ───────────────────────────────────── */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filters label {
  flex: 1 1 180px;
}
.filters button {
  min-height: 44px;
  align-self: flex-end;
}

/* ── 51  Actions row ───────────────────────────────────── */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── 52  Quick links grid ──────────────────────────────── */
.quick {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.quick button {
  min-height: 44px;
  flex: 1 1 180px;
}

/* ── 53  Section nav (sub-pages) ───────────────────────── */
.section-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-nav button {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
}
.section-nav button.active {
  color: var(--gold-text);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* ── 54  Banner / messages ─────────────────────────────── */
.banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text);
}
.form-error {
  color: #f0968a;
  font-size: 13px;
  min-height: 20px;
}

/* ── 55  Modal / dialog form ───────────────────────────── */
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.dialog-head button {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  min-height: auto;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-head button:hover {
  color: var(--text);
}

/* ── 56  Directory profiles ────────────────────────────── */
.directory-avatar4 {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
}
.directory-profile4 {
  text-align: center;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.directory-profile4 img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dim);
}
.directory-profile4 p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* ── 57  Profile & photo ───────────────────────────────── */
.profile-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dim);
}

/* (58 – moved to 73 at end of file) */

/* ── 59  Late row highlight ────────────────────────────── */
.late-row4 {
  background: rgba(240, 150, 138, 0.06);
}

/* ── 60  Approval chain settings ───────────────────────── */
#editor-form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 20px;
}

/* ── 61  Muted text ────────────────────────────────────── */
.muted {
  color: var(--text-muted);
}

/* ── 62  Back to dashboard ─────────────────────────────── */
#back-overview {
  margin-bottom: 8px;
  font-size: 13px;
}

/* ── 63  Responsive – inner pages ──────────────────────── */
@media (max-width: 767px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-title {
    font-size: 24px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  /* chat-layout4 responsive → section 74 */
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filters label {
    flex: 1 1 auto;
  }
  .section-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .leave-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   64 · Leave Balance Cards
   ============================================================ */
.leave-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.leave-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.leave-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.leave-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.leave-card-head .chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.leave-big {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 36px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}
.leave-big .muted {
  font-size: 14px;
  font-weight: 400;
}
.leave-bar {
  height: 6px;
  background: var(--card-alt);
  border-radius: 999px;
  overflow: hidden;
}
.leave-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.leave-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.leave-stats span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.leave-stats b {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ============================================================
   65 · Effort Bars (dashboard top-hours widget)
   ============================================================ */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
}
.bar-row span:first-child {
  flex: 0 0 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}
.bar-row .bar {
  flex: 1;
  height: 6px;
  background: var(--card-alt);
  border-radius: 999px;
  overflow: hidden;
}
.bar-row .bar span {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.bar-row strong {
  flex: 0 0 60px;
  text-align: right;
  font-weight: 600;
  color: var(--text);
}

/* ============================================================
   66 · Hour Progress (dashboard weekly/monthly hours)
   ============================================================ */
.hours-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.progress-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.progress-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.progress-heading strong {
  font-size: 18px;
  font-weight: 600;
}
.progress-heading small {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}
.progress-track span {
  display: block;
  height: 100%;
  border-radius: var(--radius-chip);
  transition: width 0.3s ease;
}
.progress-track.low span { background: #f0968a; }
.progress-track.partial span { background: #e9b65c; }
.progress-track.complete span { background: #7fd1a8; }
.progress-track.over span { background: #8fb4f0; }
.progress-track.neutral span { background: var(--text-muted); }
.progress-caption {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   67 · List Search (inline table filter)
   ============================================================ */
.list-search {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.list-search input {
  flex: 1;
  max-width: 300px;
  background: var(--card-alt);
  color: var(--text);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  padding: 0 12px;
  min-height: 36px;
  font: inherit;
  font-size: 13px;
}
.list-search .note {
  margin: 0;
  font-size: 12px;
}

/* ============================================================
   68 · Staff Status Widget polish
   ============================================================ */
.staff-status-widget .filters {
  margin-bottom: 12px;
}
.status-count {
  margin-top: 8px;
}

/* ============================================================
   69 · Approval table buttons (compact inline)
   ============================================================ */
.table-wrap td button + button {
  margin-left: 4px;
}
.table-wrap td .text-button {
  padding: 4px 8px;
  font-size: 12px;
  min-height: auto;
}

/* ============================================================
   70 · Checkbox accent colour
   ============================================================ */
input[type="checkbox"] {
  accent-color: var(--gold);
}

/* ============================================================
   71 · Fieldset (multi-checkbox groups in editors)
   ============================================================ */
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
}
fieldset legend {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 6px;
}
fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 0;
  min-width: 180px;
}

/* ============================================================
   72 · Toggle switch (role="switch")
   ============================================================ */
[role="switch"] {
  display: inline-flex;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  padding: 3px;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.2s;
}
[role="switch"][aria-checked="true"] {
  background: var(--gold);
  justify-content: flex-end;
}
[role="switch"][aria-checked="false"],
[role="switch"]:not([aria-checked="true"]) {
  background: var(--border);
  justify-content: flex-start;
}
[role="switch"] span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
}

/* ── 75  Login page ──────────────────────────────────────── */

.login {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
  background: var(--bg);
}
.login-brand {
  flex: 1 1 420px;
  background: var(--sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: 56px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
}
.login-brand .office-image {
  display: none; /* replaced by CSS branding below */
}
.login-brand::before {
  content: 'PI';
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 48px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--text);
}
.login-brand::after {
  content: 'PARTNERS';
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  letter-spacing: 5px;
  color: var(--text);
  margin-top: -32px;
}
.login-form {
  flex: 1 1 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  box-sizing: border-box;
}
.login-form > div {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--gold-text);
  margin: 0;
}
.crew-login-heading h1 {
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  color: var(--gold);
  letter-spacing: -0.4px;
}
.crew-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin: 4px 0 0;
  line-height: 1.5;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.login-form input[type="email"],
.login-form input[type="password"] {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
}
.login-form input:focus {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
  border-color: var(--gold-dim);
}
#login-form button[type="submit"] {
  width: 100%;
  min-height: 44px;
  background: var(--gold);
  color: var(--gold-dark);
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
#login-form button[type="submit"]:hover {
  filter: brightness(1.1);
}
.login-form .form-error:empty {
  display: none;
}
.login-form .form-error {
  color: var(--danger);
  font-size: 13px;
}
.login-form .note {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}
.login-form .text-button {
  color: var(--gold);
  font-size: 13px;
}

@media (max-width: 767px) {
  .login-brand {
    padding: 32px 24px;
    flex: 1 1 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .login-form {
    flex: 1 1 100%;
    padding: 24px 16px;
  }
  .login-form > div {
    padding: 24px 20px;
  }
}

/* ── 73  Chat – enhanced layout ──────────────────────────── */

/* Two-pane container */
.chat-layout4 {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-height: 560px;
}
.chat-layout4 > .panel {
  border-radius: 0;
  border: 0;
  margin: 0;
  gap: 0;
  padding: 0;
  overflow-y: auto;
}
/* Left pane — conversation list */
.chat-layout4 > .panel:first-child {
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
/* Right pane — messages */
.chat-layout4 > .panel:last-child {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.chat-layout4 > .panel:last-child > h2 {
  margin: 0;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.chat-layout4 > .panel:last-child > p {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.chat-layout4 > .panel:last-child > label {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-layout4 > .panel:last-child > label input {
  flex: 1;
}

/* Conversation list items */
.chat-thread4 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: var(--text);
  min-height: auto;
  transition: background 0.15s;
  position: relative;
}
.chat-thread4:hover {
  background: rgba(212, 176, 122, 0.06);
}
.chat-thread4:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.chat-thread4 strong {
  font-size: 14px;
  font-weight: 600;
}
.chat-thread4 span {
  font-size: 12px;
  color: var(--text-muted);
}
.chat-thread4 small {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.chat-thread4 .badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  min-width: 20px;
  text-align: center;
  padding: 2px 8px;
}

/* Message history */
.chat-history4 {
  flex: 1;
  max-height: none;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-history4::-webkit-scrollbar {
  width: 6px;
}
.chat-history4::-webkit-scrollbar-track {
  background: transparent;
}
.chat-history4::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Individual messages */
.chat-message4 {
  padding: 10px 16px;
  border-bottom: none;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 75%;
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
}
.chat-message4.own {
  align-self: flex-end;
  background: rgba(212, 176, 122, 0.10);
  border-color: var(--gold-dim);
}
.chat-message4 strong {
  font-size: 13px;
  color: var(--gold-text);
  font-weight: 600;
}
.chat-message4.own strong {
  color: var(--gold);
}
.chat-message4 small {
  font-size: 11px;
  color: var(--text-muted);
}
.chat-message4 p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.chat-message4 .muted {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.chat-message4 .text-button {
  font-size: 12px;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-message4:hover .text-button {
  opacity: 1;
}
.chat-message4 .text-button + .text-button {
  margin-left: 4px;
}

/* Compose bar */
#chat-send4 {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--card);
  align-items: flex-end;
}
#chat-send4 label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0;  /* hide the "Message" label text */
}
#chat-send4 textarea {
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  font-size: 14px;
}
#chat-send4 button {
  flex-shrink: 0;
}
#chat-send4 #reply-label4:empty {
  display: none;
}
#reply-label4 {
  font-size: 12px;
  color: var(--gold-text);
  padding: 4px 0;
}

/* Refresh / search row inside chat panel */
#chat-search4 {
  max-width: 220px;
}
#chat-refresh4 {
  font-size: 13px;
  padding: 6px 12px;
}

/* ── 74  Chat – responsive ───────────────────────────────── */
@media (max-width: 767px) {
  .chat-layout4 {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .chat-layout4 > .panel:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
  }
  .chat-message4 {
    max-width: 90%;
  }
}
