@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =============================================================================
   one.isurus.com — UI Framework · Milestone 1
   app.css
   =============================================================================
   Icon note: nav icons use Unicode/emoji as placeholders.
   Replace with Phosphor Icons or Heroicons SVG sprite in production.
   ============================================================================= */

/* 1. Custom Properties
   ============================================================================= */
:root {
  /* Brand */
  --c-brand:        #2563eb;
  --c-brand-hover:  #1d4ed8;
  --c-brand-light:  #eff6ff;
  --c-brand-rgb:    37, 99, 235;

  /* Sidebar surfaces */
  --c-sidebar-bg:          #0f172a;
  --c-sidebar-hover:       rgba(255,255,255,.07);
  --c-sidebar-active-bg:   rgba(37,99,235,.18);
  --c-sidebar-active-bar:  #2563eb;
  --c-sidebar-text:        #94a3b8;
  --c-sidebar-text-hover:  #e2e8f0;
  --c-sidebar-text-active: #ffffff;
  --c-sidebar-divider:     rgba(255,255,255,.08);
  --c-sidebar-group:       #475569;

  /* Page surfaces */
  --c-topbar-bg:   #ffffff;
  --c-page-bg:     #f0f2f5;
  --c-card:        #ffffff;

  /* Text */
  --c-text:   #1e293b;
  --c-text-2: #64748b;
  --c-text-3: #94a3b8;
  --c-text-inv: #ffffff;

  /* Border */
  --c-border:   #e8edf2;
  --c-border-2: #d0d7df;

  /* Semantic colours */
  --c-green:     #16a34a; --c-green-bg:  #f0fdf4;
  --c-amber:     #d97706; --c-amber-bg:  #fffbeb;
  --c-red:       #dc2626; --c-red-bg:    #fef2f2;
  --c-blue:      #0284c7; --c-blue-bg:   #f0f9ff;
  --c-purple:    #7c3aed; --c-purple-bg: #f5f3ff;
  --c-slate:     #64748b; --c-slate-bg:  #f8fafc;

  /* Layout */
  --sidebar-w:    260px;
  --topbar-h:     64px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', Consolas, monospace;

  /* Spacing */
  --s-1:  4px;  --s-2:  8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;  --s-8: 32px;  --s-10: 40px;  --s-12: 48px;  --s-16: 64px;

  /* Radius */
  --r-sm:   4px;  --r:      8px;  --r-lg:  12px;  --r-xl:  16px;  --r-full: 9999px;

  /* Shadow */
  --sh-sm: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.05);
  --sh:    0 2px 4px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.05);
  --sh-md: 0 4px 16px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.05);
  --sh-lg: 0 12px 28px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.05);
  --sh-xl: 0 24px 48px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.05);

  /* Transition */
  --t-fast: 120ms ease;
  --t:      200ms ease;
  --t-slow: 300ms ease;
}

/* Portal variants — override variables only */
[data-portal="isurus"] {
  --c-brand:             #7c3aed;
  --c-brand-hover:       #6d28d9;
  --c-brand-light:       #f5f3ff;
  --c-brand-rgb:         124, 58, 237;
  --c-sidebar-bg:        #1a0533;
  --c-sidebar-active-bg: rgba(124,58,237,.18);
  --c-sidebar-active-bar:#7c3aed;
}

[data-portal="customer"] {
  --c-brand:             #0284c7;
  --c-brand-hover:       #0369a1;
  --c-brand-light:       #f0f9ff;
  --c-brand-rgb:         2, 132, 199;
  --c-sidebar-bg:        #0c2340;
  --c-sidebar-active-bg: rgba(2,132,199,.18);
  --c-sidebar-active-bar:#0284c7;
}

/* 2. Reset & Base
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  min-height: 100vh;
}
a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; }
ul, ol { list-style: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }

/* Skip to main content (accessibility) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--s-4);
  z-index: 9999;
  padding: var(--s-2) var(--s-4);
  background: var(--c-brand);
  color: var(--c-text-inv);
  border-radius: var(--r);
  font-weight: 600;
  font-size: .875rem;
}
.skip-link:focus-visible { top: var(--s-4); }

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

/* 4. Sidebar
   ============================================================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--c-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--t-slow), width var(--t-slow);
  overflow: hidden;
}

.sidebar.is-collapsed {
  width: 64px;
}
.sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-group-label,
.sidebar.is-collapsed .nav-chevron,
.sidebar.is-collapsed .nav-badge,
.sidebar.is-collapsed .sidebar-user-info {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}
.sidebar.is-collapsed .nav-item  { justify-content: center; }
.sidebar.is-collapsed .nav-icon  { margin-right: 0; }
.sidebar.is-collapsed .nav-sub   { display: none; }
.sidebar.is-collapsed .sidebar-footer-avatar { margin-right: 0; }

/* Sidebar brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  border-bottom: 1px solid var(--c-sidebar-divider);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-brand img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: opacity var(--t-slow);
}
.sidebar.is-collapsed .sidebar-brand {
  height: var(--topbar-h);
  padding: var(--s-2) var(--s-3);
}

/* Sidebar navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-2) 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section { margin-bottom: var(--s-1); }

.nav-group-label {
  display: block;
  padding: var(--s-3) var(--s-4) var(--s-1);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-sidebar-group);
  white-space: nowrap;
  transition: opacity var(--t-slow);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 7px var(--s-3);
  margin: 1px var(--s-2);
  width: calc(100% - var(--s-4));
  color: var(--c-sidebar-text);
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  user-select: none;
  min-height: 36px;
  text-align: left;
  border-radius: var(--r);
}
.nav-item:hover { background: var(--c-sidebar-hover); color: var(--c-sidebar-text-hover); text-decoration: none; }
.nav-item.is-active {
  background: var(--c-sidebar-active-bg);
  color: var(--c-sidebar-text-active);
  font-weight: 600;
}
.nav-item.is-active::before { content: none; }

.nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  font-style: normal;
  line-height: 1;
  transition: margin var(--t-slow);
}

/* SVG icon inside nav-icon span */
.ni-svg { display: block; flex-shrink: 0; overflow: visible; }

/* Style switching — controlled by data-icon-style on <html> (set by icons.js) */
html:not([data-icon-style="emoji"]) .ni-emoji { display: none; }
html[data-icon-style="emoji"] .ni-svg         { display: none; }

/* Duotone: boost fill-opacity slightly on hover/active for depth */
.nav-item:hover .ni-svg [fill-opacity] { fill-opacity: 0.26; }
.nav-item.is-active .ni-svg [fill-opacity] { fill-opacity: 0.22; }
.nav-label {
  flex: 1;
  font-size: .8125rem;
  font-weight: 500;
  transition: opacity var(--t-slow);
}

.nav-chevron {
  flex-shrink: 0;
  display: inline-block;
  transition: transform var(--t-fast), opacity var(--t-slow);
  color: var(--c-sidebar-group);
}
.nav-item.is-open > .nav-chevron { transform: rotate(90deg); }

.nav-badge {
  background: var(--c-brand);
  color: white;
  font-size: .625rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
  transition: opacity var(--t-slow);
}

/* Sub-navigation */
.nav-sub {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--t-slow);
}
.nav-sub.is-open { max-height: 800px; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 5px var(--s-3) 5px calc(var(--s-3) + 24px);
  margin: 1px var(--s-2);
  width: calc(100% - var(--s-4));
  color: var(--c-sidebar-text);
  font-size: .8125rem;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  min-height: 30px;
  border-radius: var(--r-sm);
}
.nav-sub-item:hover { background: var(--c-sidebar-hover); color: var(--c-sidebar-text-hover); text-decoration: none; }
.nav-sub-item.is-active { color: var(--c-sidebar-text-active); background: rgba(255,255,255,.06); }

/* Sidebar footer */
.sidebar-footer {
  padding: var(--s-3) var(--s-2);
  border-top: 1px solid var(--c-sidebar-divider);
  flex-shrink: 0;
}
.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-2);
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t-fast);
  overflow: hidden;
}
.sidebar-footer-user:hover { background: var(--c-sidebar-hover); }
.sidebar-footer-avatar { flex-shrink: 0; }
.sidebar-user-info { min-width: 0; overflow: hidden; transition: opacity var(--t-slow); }
.sidebar-user-name { font-size: .8125rem; font-weight: 600; color: var(--c-sidebar-text-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .6875rem; color: var(--c-sidebar-text); white-space: nowrap; }

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
}
.sidebar-backdrop.is-visible { opacity: 1; pointer-events: auto; }

/* 5. Main Area
   ============================================================================= */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--t-slow);
}
.sidebar.is-collapsed ~ .main-area { margin-left: 64px; }

/* 6. Topbar
   ============================================================================= */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--c-topbar-bg);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 var(--s-6);
  gap: var(--s-3);
  z-index: 90;
}

.topbar-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r);
  color: var(--c-text-2);
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-toggle:hover { background: var(--c-page-bg); color: var(--c-text); }

.topbar-search { flex: 1; max-width: 480px; }
.topbar-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px var(--s-4);
  background: var(--c-page-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  color: var(--c-text-3);
  font-size: .875rem;
  transition: border-color var(--t-fast), background var(--t-fast);
  cursor: text;
}
.topbar-search-btn:hover { border-color: var(--c-brand); color: var(--c-text-2); background: var(--c-card); }
.search-shortcut {
  margin-left: auto;
  font-size: .6875rem;
  background: var(--c-border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  color: var(--c-text-3);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

.topbar-btn {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r);
  color: var(--c-text-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-btn:hover { background: var(--c-page-bg); color: var(--c-text); }
.topbar-btn .badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--c-red);
  border-radius: var(--r-full);
  border: 2px solid var(--c-topbar-bg);
}

.quick-add-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 7px var(--s-4);
  background: var(--c-brand);
  color: var(--c-text-inv);
  border-radius: var(--r);
  font-weight: 500;
  font-size: .8125rem;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.quick-add-btn:hover { background: var(--c-brand-hover); transform: translateY(-1px); box-shadow: var(--sh-md); }

/* User avatar button */
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px var(--s-2);
  border-radius: var(--r);
  transition: background var(--t-fast);
}
.user-avatar-btn:hover { background: var(--c-page-bg); }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: .8125rem; font-weight: 600; color: var(--c-text); }
.user-role { font-size: .6875rem; color: var(--c-text-2); }

/* 7. Avatar
   ============================================================================= */
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: var(--c-brand);
  color: var(--c-text-inv);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-sm  { width: 24px; height: 24px; font-size: .625rem; }
.avatar-lg  { width: 40px; height: 40px; font-size: .875rem; }
.avatar-xl  { width: 48px; height: 48px; font-size: 1rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 8. Page Content
   ============================================================================= */
.page-content {
  flex: 1;
  padding: var(--s-6);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.breadcrumb-item {
  font-size: .8125rem;
  color: var(--c-text-2);
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.breadcrumb-item a { color: var(--c-text-2); }
.breadcrumb-item a:hover { color: var(--c-brand); text-decoration: none; }
.breadcrumb-sep { color: var(--c-text-3); font-size: .75rem; }
.breadcrumb-item:last-child { color: var(--c-text); font-weight: 500; }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
  flex-wrap: wrap;
}
.page-title    { font-size: 1.375rem; font-weight: 700; color: var(--c-text); letter-spacing: -.02em; line-height: 1.2; }
.page-subtitle { font-size: .875rem; color: var(--c-text-2); margin-top: var(--s-1); }
.page-actions  { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }

/* 9. Cards
   ============================================================================= */
.card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-border);
  gap: var(--s-3);
}
.card-title    { font-size: .9375rem; font-weight: 600; color: var(--c-text); }
.card-subtitle { font-size: .8125rem; color: var(--c-text-2); margin-top: 2px; }
.card-body     { padding: var(--s-5); }
.card-footer {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--c-border);
  background: var(--c-page-bg);
  font-size: .8125rem;
  color: var(--c-text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

/* 10. Stats Cards
   ============================================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat-card {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.stat-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--c-brand));
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-lg);
  background: var(--stat-bg, var(--c-brand-light));
  color: var(--stat-color, var(--c-brand));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
}
.stat-label { font-size: .8125rem; color: var(--c-text-2); font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--c-text); letter-spacing: -.03em; line-height: 1; }
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .6875rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.stat-change.up      { background: var(--c-green-bg); color: var(--c-green); }
.stat-change.down    { background: var(--c-red-bg);   color: var(--c-red);   }
.stat-change.neutral { background: var(--c-slate-bg); color: var(--c-slate); }

/* 11. Dashboard Grid
   ============================================================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s-4);
}
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* Widget drag state */
.widget-card[draggable="true"] {
  cursor: grab;
  border: 2px dashed var(--c-brand) !important;
  box-shadow: var(--sh-md);
}
.widget-card[draggable="true"]:active { cursor: grabbing; }

/* 12. Tables
   ============================================================================= */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
  font-size: .8125rem;
}
.table thead tr { background: var(--c-page-bg); }
.table th {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-2);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  user-select: none;
  transition: color var(--t-fast);
}
.table th[data-sort] { cursor: pointer; }
.table th[data-sort]:hover { color: var(--c-text); }
.table th.sort-asc::after  { content: ' ↑'; color: var(--c-brand); }
.table th.sort-desc::after { content: ' ↓'; color: var(--c-brand); }
.table td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--c-slate-bg); }
.table tbody tr.is-selected { background: var(--c-brand-light); }

.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  flex-wrap: wrap;
}
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  background: var(--c-card);
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
  gap: var(--s-3);
  font-size: .8125rem;
  color: var(--c-text-2);
}
.bulk-actions-bar {
  display: none;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  background: var(--c-brand-light);
  border-bottom: 1px solid var(--c-border);
  font-size: .8125rem;
}

/* 13. Buttons
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 7px var(--s-4);
  border-radius: var(--r);
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
}
.btn-primary   { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }
.btn-primary:hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); transform: translateY(-1px); box-shadow: var(--sh-md); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--c-card); color: var(--c-text); border-color: var(--c-border-2); }
.btn-secondary:hover { background: var(--c-page-bg); border-color: var(--c-brand); color: var(--c-brand); text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--c-text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--c-page-bg); color: var(--c-text); text-decoration: none; }
.btn-danger    { background: var(--c-red-bg); color: var(--c-red); border-color: transparent; }
.btn-danger:hover { background: var(--c-red); color: #fff; text-decoration: none; }
.btn-sm        { padding: 4px var(--s-3); font-size: .75rem; }
.btn-lg        { padding: var(--s-3) var(--s-6); font-size: .9375rem; }
.btn-icon      { width: 32px; height: 32px; padding: 0; }
.btn-icon-sm   { width: 26px; height: 26px; padding: 0; border-radius: var(--r-sm); }
.btn:disabled  { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* 14. Badges
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: .6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
}
.badge-green  { background: var(--c-green-bg);  color: var(--c-green);  }
.badge-amber  { background: var(--c-amber-bg);  color: var(--c-amber);  }
.badge-red    { background: var(--c-red-bg);    color: var(--c-red);    }
.badge-blue   { background: var(--c-blue-bg);   color: var(--c-blue);   }
.badge-purple { background: var(--c-purple-bg); color: var(--c-purple); }
.badge-slate  { background: var(--c-slate-bg);  color: var(--c-slate);  }
.badge-brand  { background: var(--c-brand-light); color: var(--c-brand); }

/* 15. Form Elements
   ============================================================================= */
.form-group  { display: flex; flex-direction: column; gap: var(--s-2); }
.form-label  { font-size: .8125rem; font-weight: 500; color: var(--c-text); }
.form-label .req { color: var(--c-red); margin-left: 2px; }
.form-hint   { font-size: .75rem; color: var(--c-text-2); }
.form-error  { font-size: .75rem; color: var(--c-red); }

/* Password requirements, ticked off while a new password is typed (assets/js/password-guide.js) */
.pw-guide { font-size: .75rem; color: var(--c-text-2); display: flex; flex-direction: column; gap: 2px; }
.pw-guide[hidden], .pw-guide-note[hidden] { display: none; }
.pw-guide-title { font-weight: 500; }
.pw-guide-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.pw-guide-list li { display: flex; align-items: baseline; gap: 6px; }
.pw-guide-mark { flex: none; width: 1em; text-align: center; font-weight: 700; color: var(--c-text-3); }
.pw-guide-list li.is-met { color: var(--c-green); }
.pw-guide-list li.is-met .pw-guide-mark { color: var(--c-green); }
.pw-guide-list li.is-unmet { color: var(--c-red); }
.pw-guide-list li.is-unmet .pw-guide-mark { color: var(--c-red); }
.pw-guide-state, .pw-guide-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.input {
  width: 100%;
  padding: 7px var(--s-3);
  border: 1px solid var(--c-border-2);
  border-radius: var(--r);
  background: var(--c-card);
  color: var(--c-text);
  font-size: .875rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(var(--c-brand-rgb), .12);
}
.input::placeholder { color: var(--c-text-3); }
.input-sm { padding: 4px var(--s-2); font-size: .8125rem; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; flex: 1; }
.input-group .input:first-child { border-radius: var(--r) 0 0 var(--r); }
.input-group .input:last-child  { border-radius: 0 var(--r) var(--r) 0; }
.input-group .btn  { border-radius: 0; }
.input-group .btn:last-child  { border-radius: 0 var(--r) var(--r) 0; }
.input-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); }

/* 16. Dropdowns
   ============================================================================= */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  z-index: 200;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.dropdown-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 8px var(--s-4);
  color: var(--c-text);
  font-size: .8125rem;
  cursor: pointer;
  transition: background var(--t-fast);
}
.dropdown-item:hover         { background: var(--c-page-bg); text-decoration: none; color: var(--c-text); }
.dropdown-item.is-active     { color: var(--c-brand); }
.dropdown-item.is-danger     { color: var(--c-red); }
.dropdown-item.is-danger:hover { background: var(--c-red-bg); }
.dropdown-divider            { height: 1px; background: var(--c-border); margin: var(--s-1) 0; }
.dropdown-header {
  padding: 6px var(--s-4);
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-2);
}

/* 17. Search Overlay
   ============================================================================= */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast);
  backdrop-filter: blur(2px);
}
.search-overlay.is-open { opacity: 1; pointer-events: auto; }
.search-box {
  width: 100%;
  max-width: 600px;
  background: var(--c-card);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  overflow: hidden;
  transform: translateY(-12px) scale(.98);
  transition: transform var(--t-fast);
}
.search-overlay.is-open .search-box { transform: translateY(0) scale(1); }
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-border);
}
.search-input-wrap svg { color: var(--c-text-2); flex-shrink: 0; }
.search-input-main {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--c-text);
  background: transparent;
}
.search-input-main::placeholder { color: var(--c-text-3); }
.search-esc {
  font-size: .6875rem;
  color: var(--c-text-3);
  background: var(--c-border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.search-results { max-height: 400px; overflow-y: auto; }
.search-category {
  padding: var(--s-3) var(--s-5) var(--s-1);
  font-size: .625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-2);
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-result-item:hover,
.search-result-item.is-focused { background: var(--c-page-bg); }
.search-result-icon {
  width: 32px; height: 32px;
  border-radius: var(--r);
  background: var(--c-page-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem;
  flex-shrink: 0;
}
.search-result-title { font-size: .875rem; font-weight: 500; color: var(--c-text); }
.search-result-meta  { font-size: .75rem;  color: var(--c-text-2); margin-top: 1px; }
.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-2) var(--s-5);
  border-top: 1px solid var(--c-border);
  font-size: .6875rem;
  color: var(--c-text-3);
  background: var(--c-page-bg);
}
.search-footer kbd {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: .625rem;
}

/* 18. Quick Actions dropdown
   ============================================================================= */
.quick-actions-menu { min-width: 240px; }
.quick-action-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 8px var(--s-3);
  cursor: pointer;
  transition: background var(--t-fast);
  border-radius: var(--r);
  margin: 2px var(--s-2);
}
.quick-action-item:hover { background: var(--c-page-bg); text-decoration: none; color: var(--c-text); }
.qa-icon {
  width: 32px; height: 32px;
  border-radius: var(--r);
  background: var(--qa-bg, var(--c-brand-light));
  color: var(--qa-color, var(--c-brand));
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem;
  flex-shrink: 0;
}
.qa-label      { font-size: .8125rem; font-weight: 500; color: var(--c-text); }
.qa-shortcut   { margin-left: auto; font-size: .6875rem; color: var(--c-text-3); font-family: var(--font-mono); }

/* 19. Notifications panel
   ============================================================================= */
.notif-panel {
  min-width: 360px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.notif-title { font-size: .9375rem; font-weight: 600; }
.notif-list  { overflow-y: auto; flex: 1; }
.notif-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--c-page-bg); }
.notif-item.is-unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--c-brand);
}
.notif-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: .875rem;
}
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: .8125rem; color: var(--c-text); line-height: 1.4; }
.notif-time { font-size: .6875rem; color: var(--c-text-3); margin-top: 3px; }
.notif-footer {
  padding: var(--s-3) var(--s-4);
  text-align: center;
  border-top: 1px solid var(--c-border);
  background: var(--c-page-bg);
  flex-shrink: 0;
}

/* 20. Activity feed
   ============================================================================= */
.activity-feed { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  position: relative;
}
.activity-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px; top: 48px;
  width: 2px; bottom: 0;
  background: var(--c-border);
}
.activity-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  color: #fff;
}
.activity-content,
.activity-body { flex: 1; min-width: 0; padding-top: 4px; }
.activity-text { font-size: .8125rem; color: var(--c-text); line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-text a { color: var(--c-brand); }
.activity-time { font-size: .6875rem; color: var(--c-text-3); margin-top: 3px; }

/* 21. Tabs
   ============================================================================= */
.tab-list,
.tabs-nav {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.tab-list::-webkit-scrollbar,
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: var(--s-3) var(--s-4);
  font-size: .875rem;
  font-weight: 500;
  color: var(--c-text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}
.tab-btn:hover    { color: var(--c-text); }
.tab-btn.is-active { color: var(--c-brand); border-bottom-color: var(--c-brand); font-weight: 600; }
.tab-panel { display: none; padding-top: var(--s-5); }
.tab-panel.is-active { display: block; }

/* 22. Pagination
   ============================================================================= */
.pagination { display: flex; align-items: center; gap: var(--s-1); }
.page-btn {
  min-width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  font-size: .8125rem;
  color: var(--c-text-2);
  background: var(--c-card);
  cursor: pointer;
  transition: all var(--t-fast);
}
.page-btn:hover { border-color: var(--c-brand); color: var(--c-brand); }
.page-btn.is-active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* 23. Filter bar / chips
   ============================================================================= */
.filters-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0 var(--s-4);
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 3px var(--s-3);
  background: var(--c-brand-light);
  color: var(--c-brand);
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 500;
}
.filter-chip-remove { cursor: pointer; opacity: .6; line-height: 1; }
.filter-chip-remove:hover { opacity: 1; }

/* 24. View toggle (list/kanban)
   ============================================================================= */
.view-toggle {
  display: flex;
  align-items: center;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow: hidden;
}
.view-btn {
  padding: 5px var(--s-3);
  font-size: .75rem;
  color: var(--c-text-2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.view-btn.is-active { background: var(--c-brand); color: #fff; }
.view-btn:hover:not(.is-active) { background: var(--c-page-bg); }

/* 25. Detail layout
   ============================================================================= */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--s-6);
  align-items: start;
}
.key-value-list {
  display: grid;
  grid-template-columns: 110px 1fr;
}
.key-value-list dt,
.key-value-list dd {
  font-size: .8125rem;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-border);
}
.key-value-list dt {
  color: var(--c-text-2);
  font-weight: 500;
  padding-right: var(--s-3);
}
.key-value-list dd { color: var(--c-text); }
.key-value-list dt:nth-last-of-type(1),
.key-value-list dd:last-child { border-bottom: none; }
.kv-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: .8125rem;
}
.kv-item:last-child { border-bottom: none; }
.kv-key { color: var(--c-text-2); font-weight: 500; min-width: 120px; flex-shrink: 0; }
.kv-val { color: var(--c-text); flex: 1; }

/* 26. Team member list
   ============================================================================= */
.team-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.team-member-chip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px var(--s-2) 4px 4px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 500;
  color: var(--c-text);
  background: var(--c-card);
}

/* 27. File list
   ============================================================================= */
.file-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  transition: background var(--t-fast);
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--c-page-bg); }
.file-icon {
  width: 36px; height: 36px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.file-name { font-size: .8125rem; font-weight: 500; color: var(--c-text); }
.file-meta { font-size: .75rem; color: var(--c-text-2); margin-top: 1px; }

/* 28. Favourite button
   ============================================================================= */
.fav-btn {
  color: var(--c-text-3);
  transition: color var(--t-fast);
}
.fav-btn:hover { color: var(--c-amber); }
.fav-btn.is-fav { color: var(--c-amber); }

/* 29. Progress bar
   ============================================================================= */
.progress-bar {
  height: 6px;
  background: var(--c-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--c-brand);
  border-radius: var(--r-full);
  transition: width var(--t-slow);
}
.progress-fill.green  { background: var(--c-green); }
.progress-fill.amber  { background: var(--c-amber); }

/* 30. Kanban board
   ============================================================================= */
.kanban-board {
  display: flex;
  gap: var(--s-4);
  overflow-x: auto;
  padding-bottom: var(--s-4);
  align-items: flex-start;
}
.kanban-col {
  flex-shrink: 0;
  width: 280px;
  background: var(--c-page-bg);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
}
.kanban-col-title { font-size: .8125rem; font-weight: 600; }
.kanban-col-count {
  background: var(--c-border);
  color: var(--c-text-2);
  font-size: .6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-full);
}
.kanban-col-body { padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.kanban-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
  box-shadow: var(--sh-sm);
}
.kanban-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.kanban-card-title { font-size: .8125rem; font-weight: 500; color: var(--c-text); margin-bottom: var(--s-2); }
.kanban-card-meta  { font-size: .75rem; color: var(--c-text-2); }

/* 31. Tooltip
   ============================================================================= */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-text);
  color: var(--c-text-inv);
  font-size: .6875rem;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 400;
}
[data-tooltip]:hover::after { opacity: 1; }

/* 32. Skeleton loading
   ============================================================================= */
.skeleton {
  background: linear-gradient(90deg, var(--c-border) 25%, var(--c-page-bg) 50%, var(--c-border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--r);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 33. Empty state
   ============================================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-16) var(--s-6);
  text-align: center;
  gap: var(--s-3);
}
.empty-state-icon  { font-size: 2.5rem; opacity: .4; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--c-text); }
.empty-state-text  { font-size: .875rem; color: var(--c-text-2); max-width: 320px; }

/* 34. Utilities
   ============================================================================= */
.flex           { display: flex; }
.flex-col       { display: flex; flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.flex-1         { flex: 1; }
.flex-wrap      { flex-wrap: wrap; }
.flex-shrink-0  { flex-shrink: 0; }
.min-w-0        { min-width: 0; }
.w-full         { width: 100%; }
.text-xs        { font-size: .75rem; }
.text-sm        { font-size: .8125rem; }
.text-base      { font-size: .875rem; }
.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.text-muted     { color: var(--c-text-2); }
.text-quiet     { color: var(--c-text-3); }
.text-brand     { color: var(--c-brand); }
.text-green     { color: var(--c-green); }
.text-red       { color: var(--c-red); }
.text-amber     { color: var(--c-amber); }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.p-0  { padding: 0 !important; }
.rounded    { border-radius: var(--r); }
.rounded-lg { border-radius: var(--r-lg); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* 35. Animations
   ============================================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* "backwards", not "both": a transform left on the view after the animation would make it the
   containing block of position:fixed descendants (floating menus would open in the wrong place). */
.animate-in {
  animation: fadeUp var(--t) backwards;
}

/* 36. Scrollbar
   ============================================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }

/* 37. Focus visible (accessibility)
   ============================================================================= */
:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* 38. Responsive
   ============================================================================= */

/* Tablet: icon-only sidebar */
@media (min-width: 769px) and (max-width: 1100px) {
  :root { --sidebar-w: 64px; }
  .sidebar {
    width: 64px !important;
  }
  .sidebar .nav-label,
  .sidebar .nav-group-label,
  .sidebar .nav-chevron,
  .sidebar .nav-badge,
  .sidebar .sidebar-logo-text,
  .sidebar .sidebar-user-info {
    display: none;
  }
  .sidebar .nav-item  { justify-content: center; }
  .sidebar .nav-icon  { margin-right: 0; }
  .sidebar .nav-sub   { display: none; }
  .sidebar .sidebar-footer-avatar { margin-right: 0; }
}

/* Mobile: off-canvas sidebar */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: var(--sh-xl);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main-area { margin-left: 0 !important; }

  .topbar { padding: 0 var(--s-4); }
  .user-info { display: none; }
  .quick-add-btn .btn-label { display: none; }

  .page-content { padding: var(--s-4); }

  .col-3, .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 12; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .detail-layout { grid-template-columns: 1fr; }
  .page-header   { flex-direction: column; align-items: flex-start; }

  .notif-panel { min-width: 300px; max-width: 340px; }
  .search-box  { margin: 0 var(--s-4); }

  .kanban-board { padding-bottom: var(--s-2); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .notif-panel { right: -50px; }
}

/* 39. Print
   ============================================================================= */
@media print {
  .sidebar, .topbar, .sidebar-backdrop, .search-overlay { display: none !important; }
  .main-area { margin-left: 0 !important; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* Tenant branding: an uploaded logo in the sidebar (shell.js applyBranding) */
.sidebar-brand.is-tenant-logo img { width: auto; max-width: 100%; max-height: 56px; }
.sidebar-brand.is-tile img { background: #ffffff; padding: 6px 10px; border-radius: var(--r); }
.sidebar.is-collapsed .sidebar-brand.is-tenant-logo img { max-height: 36px; padding: 2px 4px; }
