/* ================================================================
   main.css — Hillside Medical Group Task Management
   Font: Plus Jakarta Sans | Sidebar: Navy | Clean solid design
   ================================================================ */

:root {
  /* Brand */
  --red: #E31D3C;
  --red-dark: #C41835;
  --red-light: #FEF2F4;
  --blue: #2563EB;
  --blue-dark: #1D4ED8;
  --blue-light: #EFF6FF;
  --navy: #0D1B3E;

  /* Surfaces */
  --bg: #F1F5F9;
  --card-bg: #FFFFFF;
  --surface: #FFFFFF;
  --sidebar-bg: #0D1B3E;

  /* Borders */
  --border: #E2E8F0;
  --border-dark: #CBD5E1;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  /* Semantic */
  --green: #16A34A;
  --green-light: #DCFCE7;
  --orange: #EA580C;
  --orange-light: #FFF7ED;
  --yellow: #D97706;
  --yellow-light: #FFFBEB;
  --purple: #7C3AED;
  --purple-light: #F5F3FF;

  /* Shadows — no blur, crisp */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow:    0 1px 3px rgba(15,23,42,0.09), 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 4px 8px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 24px rgba(15,23,42,0.10), 0 4px 8px rgba(15,23,42,0.05);
  --shadow-xl: 0 24px 48px rgba(15,23,42,0.14), 0 8px 16px rgba(15,23,42,0.06);

  /* Radii */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Layout */
  --sidebar-width:  264px;
  --topbar-height:  64px;

  /* Font */
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: var(--font); cursor: pointer; }
input, textarea { cursor: text; }
img { max-width: 100%; height: auto; }

/* ── App Layout ── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
}

.app-content {
  flex: 1;
  padding: 32px;
  max-width: 1400px;
  width: 100%;
}

/* ── Topbar ── */

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15,23,42,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.topbar-menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.topbar-menu-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.topbar-breadcrumb {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-notifications {
  position: relative;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.topbar-notifications:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.notif-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid white;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.topbar-user:hover {
  border-color: var(--border-dark);
  box-shadow: var(--shadow-sm);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, #1D4ED8 100%);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.viewing-as-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  color: #92400E;
}

.viewing-as-exit {
  background: #92400E;
  color: white;
  border: none;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

.viewing-as-exit:hover { background: #78350F; }

/* ── Notification Panel ── */

.notification-panel {
  position: fixed;
  top: calc(var(--topbar-height) + 8px);
  right: 20px;
  width: 380px;
  max-height: 500px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
}

.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.notif-panel-actions button {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.notif-panel-actions button:hover { color: var(--blue-dark); }
.notif-panel-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

.notif-panel-list {
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover { background: var(--bg); }

.notif-item.unread { background: var(--blue-light); }

.notif-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-item.read .notif-item-dot { background: var(--border); }

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.notif-item-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.notif-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notif-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  margin-left: auto;
  padding: 4px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.notif-delete:hover {
  color: var(--red);
  background: var(--red-light);
}

/* ── Page Header ── */

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-weight: 400;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left {}

.page-header-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Loading ── */

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
}

.page-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stats Grid ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px 20px 28px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--blue);
}

.stat-card-accent.red    { background: var(--red); }
.stat-card-accent.green  { background: var(--green); }
.stat-card-accent.orange { background: var(--orange); }
.stat-card-accent.purple { background: var(--purple); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -1.5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.stat-change.up   { background: var(--green-light); color: var(--green); }
.stat-change.down { background: var(--red-light);   color: var(--red); }

/* ── Card ── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.card-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.card-body {
  padding: 24px;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
  white-space: nowrap;
  font-family: var(--font);
  text-decoration: none;
  line-height: 1.4;
  letter-spacing: -0.1px;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--red);
  color: white;
  box-shadow: 0 1px 3px rgba(227,29,60,0.25);
}

.btn-primary:hover {
  background: var(--red-dark);
  box-shadow: 0 4px 12px rgba(227,29,60,0.35);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--border-dark);
}

.btn-blue {
  background: var(--blue);
  color: white;
  box-shadow: 0 1px 3px rgba(37,99,235,0.2);
}

.btn-blue:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border-dark);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
}

.btn-danger:hover {
  background: var(--red);
  color: white;
}

.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg  { padding: 12px 24px; font-size: 14px; border-radius: var(--radius-md); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Forms ── */

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.1px;
}

.form-control {
  width: 100%;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  line-height: 1.5;
}

.form-control:hover:not(:focus) { border-color: var(--border-dark); }

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-control::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

/* Custom Select — solid, no blur */
select.form-control {
  appearance: none;
  -webkit-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='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

select.form-control:focus {
  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='%232563EB' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Toolbar selects look like styled filter pills */
.table-toolbar select.form-control,
.filter-row select.form-control {
  background-color: var(--card-bg);
  border-radius: 999px;
  padding: 6px 36px 6px 14px;
  font-size: 12px;
  font-weight: 600;
  height: 34px;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.table-toolbar select.form-control:focus,
.filter-row select.form-control:focus {
  color: var(--text-primary);
  border-color: var(--blue);
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Badges ── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-p1 { background: var(--red);       color: white; }
.badge-p2 { background: #FEF3C7;          color: #92400E; }
.badge-p3 { background: var(--blue-light); color: var(--blue-dark); }

.badge-new       { background: #F1F5F9; color: var(--text-secondary); }
.badge-inprogress { background: #FFF7ED; color: #C2410C; }
.badge-review    { background: var(--purple-light); color: var(--purple); }
.badge-blocked   { background: var(--red-light);    color: var(--red); }
.badge-closed    { background: var(--green-light);  color: var(--green); }

.badge-admin      { background: var(--red-light);   color: var(--red); }
.badge-super-admin { background: #FFF7ED; color: #C2410C; }
.badge-manager    { background: var(--blue-light);  color: var(--blue-dark); }
.badge-user       { background: #F1F5F9; color: var(--text-secondary); border: 1px solid var(--border); }

.badge-daily     { background: var(--blue-light);   color: var(--blue-dark); }
.badge-monthly   { background: var(--green-light);  color: var(--green); }
.badge-long-term { background: var(--purple-light); color: var(--purple); }

/* ── Progress Bar ── */

.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, var(--red) 100%);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.progress-label-title { color: var(--text-secondary); font-weight: 500; }
.progress-label-pct   { font-weight: 800; color: var(--text-primary); }

/* ── Avatar ── */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue-dark) 100%);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }

/* ── Search Bar ── */

.search-bar { position: relative; }

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar input { padding-left: 38px; }

/* ── Filter Row ── */

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.filter-chip.active       { background: var(--blue); border-color: var(--blue); color: white; }
.filter-chip.active-red   { background: var(--red);  border-color: var(--red);  color: white; }

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 72px 32px;
  color: var(--text-secondary);
}

.empty-state svg { margin: 0 auto 16px; color: var(--border-dark); }

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc { font-size: 14px; color: var(--text-secondary); }

/* ── Toast ── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: all;
  animation: toast-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--blue); }
.toast.warning { border-left: 4px solid var(--yellow); }

.toast-title { font-weight: 700; color: var(--text-primary); margin-bottom: 2px; font-size: 13px; }
.toast-body  { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── Modal ── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
  overflow-y: auto;
}

.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
}

.modal-lg { max-width: 900px; }
.modal-sm { max-width: 460px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--border);
}

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  gap: 10px;
}

.modal-footer-right { display: flex; gap: 10px; }

/* ── Misc ── */

.divider { height: 1px; background: var(--border); margin: 20px 0; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  margin-bottom: 12px;
  margin-top: 24px;
}

/* ── Vote Button ── */

.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.vote-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.vote-btn.voted {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.vote-btn.voted:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.vote-count {
  background: rgba(255,255,255,0.22);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
}

.vote-btn:not(.voted) .vote-count {
  background: var(--bg);
  color: var(--text-primary);
}

/* ── Days Badge ── */

.days-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.days-badge.ok      { background: var(--green-light);  color: var(--green); }
.days-badge.warning { background: var(--orange-light); color: var(--orange); }
.days-badge.overdue { background: var(--red-light);    color: var(--red); }

/* ── Rank Badge ── */

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.rank-badge.rank-1     { background: #FEF9C3; color: #854D0E; }
.rank-badge.rank-2     { background: #F1F5F9; color: #475569; }
.rank-badge.rank-3     { background: #FFEDD5; color: #9A3412; }
.rank-badge.rank-other { background: var(--bg); color: var(--text-muted); font-size: 11px; }

/* ── Tabs ── */

.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  gap: 0;
}

.tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font);
  letter-spacing: -0.1px;
}

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

.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* ── Voter Chip ── */

.voter-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.voter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.chart-container { position: relative; width: 100%; }

/* ── Responsive ── */

/* Desktop: hide hamburger menu button */
@media (min-width: 1025px) {
  .topbar-menu-btn { display: none; }
}

@media (max-width: 1024px) {
  .app-main { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ── Tablet / large phone ── */
@media (max-width: 900px) {
  .table-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .table-toolbar-left { flex-direction: column; width: 100%; }
  .table-toolbar-left .form-control { width: 100% !important; }
  .table-toolbar-left .search-bar { width: 100%; }
  .table-toolbar-left .search-bar input { width: 100% !important; }
  .table-toolbar-right { justify-content: flex-end; }
}

/* ── Phone ── */
@media (max-width: 768px) {
  /* Topbar compact */
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-user-name { display: none; }
  .topbar-user-role { display: none; }
  .topbar-user { padding: 6px; border-radius: 50%; border-color: transparent; }
  .topbar-user:hover { border-color: transparent; box-shadow: none; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stat-value { font-size: 26px; letter-spacing: -0.5px; }

  /* Page */
  .app-content { padding: 16px; }
  .page-title { font-size: 19px; letter-spacing: -0.3px; }
  .page-subtitle { font-size: 12px; margin-bottom: 20px; }
  .page-header { margin-bottom: 20px; }
  .page-header-right { flex-wrap: wrap; }

  /* Notification panel — full-width bottom sheet on mobile */
  .notification-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  /* Modal — slide from bottom on mobile */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    max-width: 100% !important;
    animation: modal-slide-up 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
  }

  @keyframes modal-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Tab bar scrollable */
  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tab { flex-shrink: 0; }
}

/* ── Small phone ── */
@media (max-width: 480px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .topbar-breadcrumb { font-size: 13px; }
  .stat-card { padding: 14px 16px 14px 20px; }
  .stat-value { font-size: 22px; }
  .btn { padding: 8px 14px; font-size: 12px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
  .modal-header, .modal-body, .modal-footer { padding: 16px; }
  .notif-panel-header { padding: 14px 16px; }
  .table-toolbar { padding: 12px 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .page-header-right .btn { padding: 8px 12px; font-size: 12px; }

  /* App content bottom padding for any floating bars */
  .app-content { padding-bottom: 24px; }
}

@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: stretch; }
}

/* ================================================================
   Date Navigation Bar (Daily Goals)
   ================================================================ */
.date-nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.date-nav-display {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.date-nav-text { white-space: nowrap; }

/* ================================================================
   View Tabs (Task / Manager / Department switcher)
   ================================================================ */
.view-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.view-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color 0.15s, border-color 0.15s;
}
.view-tab:hover { color: var(--text-primary); background: var(--bg); }
.view-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: none;
}
#viewContent { padding-top: 20px; }

/* ================================================================
   Manager Grid / Cards
   ================================================================ */
.manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.manager-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.manager-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.manager-card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.manager-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
}
.manager-stat:last-child { border-right: none; }
.manager-stat-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}
.manager-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.manager-task-list { padding: 0 16px 12px; }
.manager-task-row:hover { background: var(--bg); border-radius: var(--radius-sm); }

/* ================================================================
   Department Cards
   ================================================================ */
.dept-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.dept-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
}
.dept-card-body { padding: 16px; }
.dept-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.dept-quick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dept-quick-name {
  font-size: 13px;
  font-weight: 600;
  min-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dept-empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 0;
  font-style: italic;
}

@media (max-width: 640px) {
  .manager-grid { grid-template-columns: 1fr; }
  .date-nav-text { font-size: 13px; }
  .dept-quick-row { flex-wrap: wrap; }
  .dept-quick-name { min-width: auto; }
}

/* ── Improvement Pending / Closed tabs ─────────────────────────── */
.imp-tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.imp-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s, border-color 0.15s;
}
.imp-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.imp-tab-count {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.imp-tab.active .imp-tab-count {
  background: #E8F0FE;
  color: var(--blue);
}

/* ── Merge action bar ───────────────────────────────────────────── */
.merge-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  margin-bottom: 12px;
}
.merge-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #1D4ED8;
  flex: 1;
}

/* ── Row selected highlight ─────────────────────────────────────── */
.imp-row-selected {
  background: #F0F7FF !important;
}
.imp-select-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--blue);
}

/* ── Merge modal ────────────────────────────────────────────────── */
.merge-source-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.merge-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}
.merge-title-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.merge-title-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.merge-title-option:hover {
  background: var(--bg-secondary);
}
.merge-title-option input[type="radio"] {
  flex-shrink: 0;
  accent-color: var(--blue);
}

/* ── Merge origin banner in detail overlay ──────────────────────── */
.merge-origin-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 500;
  color: #1D4ED8;
}
