/* ============================================================
   FedDeploy Portal — Main Stylesheet
   File: css/main.css
   ============================================================ */

/* ===== RESET & CSS VARIABLES ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary:    #0f1117;
  --bg-secondary:  #1a1d27;
  --bg-card:       #1e2235;
  --bg-hover:      #252840;
  --accent:        #4f8ef7;
  --accent2:       #6c63ff;
  --accent3:       #00d4aa;
  --accent4:       #f7a94f;
  --danger:        #f74f4f;
  --success:       #4fce82;
  --warning:       #f7c94f;
  --text-primary:  #e8eaf6;
  --text-secondary:#8892b0;
  --text-muted:    #5a6480;
  --border:        #2a2f45;
  --sidebar-w:     240px;
  --header-h:      60px;
  --radius:        10px;
  --shadow:        0 4px 24px rgba(0,0,0,.4);
}

html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg-primary); color: var(--text-primary); font-size: 14px; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; color: var(--text-primary); }
ul { list-style: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  transition: width .3s, transform .3s;
  flex-shrink: 0;
  z-index: 100;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
#sidebar.collapsed { width: 64px; }

.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.logo-text { transition: opacity .3s; }
#sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }

.sidebar-section { padding: 10px 0; flex: 1; overflow-y: auto; }

.sidebar-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); padding: 8px 18px 4px; white-space: nowrap;
  transition: opacity .3s;
}
#sidebar.collapsed .sidebar-label { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap; overflow: hidden;
  color: var(--text-secondary); font-size: 13px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--accent); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79,142,247,.15), transparent);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}
.nav-icon { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-text { transition: opacity .3s; }
#sidebar.collapsed .nav-text { opacity: 0; pointer-events: none; }
.nav-badge {
  background: var(--danger); color: #fff; font-size: 10px;
  padding: 2px 6px; border-radius: 10px; margin-left: auto;
  transition: opacity .3s;
}
#sidebar.collapsed .nav-badge { opacity: 0; }

/* ===== MAIN ===== */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== HEADER ===== */
#header {
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 14px;
  flex-shrink: 0;
}
#menu-toggle {
  font-size: 20px; color: var(--text-secondary);
  padding: 6px; border-radius: 6px; transition: background .2s;
}
#menu-toggle:hover { background: var(--bg-hover); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.breadcrumb .current { color: var(--accent); }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.hbtn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); color: var(--text-secondary); font-size: 16px;
  transition: background .2s, color .2s; position: relative;
}
.hbtn:hover { background: var(--bg-hover); color: var(--text-primary); }
.hbtn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  background: var(--bg-card); border-radius: 8px; cursor: pointer;
}
.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-name { font-size: 12px; font-weight: 600; }

/* ===== CONTENT ===== */
#content { flex: 1; overflow-y: auto; padding: 20px; }

/* ===== SEARCH BOX ===== */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px;
}
.search-box input { background: none; border: none; outline: none; color: var(--text-primary); font-size: 13px; flex: 1; }
.search-box span { color: var(--text-muted); }

/* ===== PAGE TITLES ===== */
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: rgba(79,142,247,.12);
  position: absolute; top: 18px; right: 18px;
}
.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-value { font-size: 26px; font-weight: 700; }
.stat-sub { font-size: 11px; color: var(--text-muted); }
.stat-trend { font-size: 11px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-cols-6-4 { display: grid; grid-template-columns: 6fr 4fr; gap: 16px; }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 15px; font-weight: 600; }

/* ===== BUTTONS ===== */
.btn {
  padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .2s;
  display: inline-flex; align-items: center; gap: 6px; border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3a7be8; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #111; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
.mission-active { color: var(--accent); font-weight: 600; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-green  { background: rgba(79,206,130,.15); color: var(--success); }
.badge-blue   { background: rgba(79,142,247,.15);  color: var(--accent); }
.badge-yellow { background: rgba(247,201,79,.15);  color: var(--warning); }
.badge-red    { background: rgba(247,79,79,.15);   color: var(--danger); }
.badge-purple { background: rgba(108,99,255,.15);  color: var(--accent2); }
.badge-gray   { background: rgba(90,100,128,.15);  color: var(--text-muted); }

/* ===== PROGRESS ===== */
.progress-bar { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .5s; }

/* ===== TABS ===== */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg-primary); padding: 4px;
  border-radius: 9px; width: fit-content; margin-bottom: 20px;
}
.tab { padding: 7px 16px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted); transition: all .2s; }
.tab.active { background: var(--bg-card); color: var(--text-primary); }
.tab:hover:not(.active) { color: var(--text-primary); }

/* ===== FORM CONTROLS ===== */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: 13px;
  outline: none; transition: border-color .2s;
}
.form-control:focus { border-color: var(--accent); }
select.form-control option { background: var(--bg-secondary); }

/* ===== TOGGLE SWITCH ===== */
.toggle {
  width: 40px; height: 22px; background: var(--border);
  border-radius: 11px; cursor: pointer; position: relative; transition: background .2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left .2s;
}
.toggle.on::after { left: 21px; }

/* ===== SETTINGS ROWS ===== */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.settings-row:last-child { border-bottom: none; }
.settings-row-info .title { font-size: 13px; font-weight: 600; }
.settings-row-info .desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 999;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 14px; width: 90%; max-width: 480px;
  padding: 24px; box-shadow: var(--shadow);
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { font-size: 20px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px; font-size: 13px;
  box-shadow: var(--shadow); transform: translateY(80px); opacity: 0;
  transition: all .3s; z-index: 9999;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ===== CALENDAR ===== */
.cal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav button:hover { border-color: var(--accent); color: var(--accent); }
.cal-month-title { font-size: 16px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day-name { text-align: center; font-size: 11px; color: var(--text-muted); padding: 6px 0; text-transform: uppercase; }
.cal-cell {
  min-height: 80px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px; cursor: pointer; transition: border-color .2s;
}
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.today { border-color: var(--accent); background: rgba(79,142,247,.07); }
.cal-cell.other-month .cal-date { color: var(--text-muted); }
.cal-date { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.cal-event { font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.avail   { background: rgba(79,206,130,.2);  color: var(--success); }
.cal-event.mission { background: rgba(79,142,247,.2);  color: var(--accent); }
.cal-event.leave   { background: rgba(247,201,79,.2);  color: var(--warning); }
.legend-list { display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ===== MAP ===== */
.map-container {
  background: var(--bg-primary); border-radius: var(--radius);
  overflow: hidden; position: relative; height: 400px;
  border: 1px solid var(--border);
}
.map-svg { width: 100%; height: 100%; }
.map-pin { cursor: pointer; transition: transform .2s; }
.map-pin:hover { transform: scale(1.3); }
.map-tooltip {
  position: absolute; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 12px; pointer-events: none;
  display: none; z-index: 10; min-width: 160px; box-shadow: var(--shadow);
  line-height: 1.7;
}
.map-legend { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }

/* ===== MEMBER CARDS ===== */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.member-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; text-align: center;
  transition: border-color .2s, transform .2s; cursor: pointer;
}
.member-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.member-big-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; border: 3px solid var(--border);
}
.member-name { font-size: 14px; font-weight: 600; }
.member-role { font-size: 12px; color: var(--text-muted); }
.member-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ===== DOCUMENT CARDS ===== */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.doc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: border-color .2s, transform .2s;
  display: flex; flex-direction: column; gap: 8px;
}
.doc-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.doc-icon { font-size: 32px; }
.doc-name { font-size: 13px; font-weight: 600; word-break: break-word; }
.doc-meta { font-size: 11px; color: var(--text-muted); }
.folder-card { background: rgba(247,201,79,.04); border-color: rgba(247,201,79,.2); }
.folder-card:hover { border-color: var(--warning); }
.doc-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .2s;
}
.doc-list-item:hover { background: var(--bg-hover); }
.doc-list-item:last-child { border-bottom: none; }
.doc-path { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; flex-wrap: wrap; }
.path-item { cursor: pointer; transition: color .2s; }
.path-item:hover, .path-item.active { color: var(--accent); }
.path-sep { color: var(--text-muted); }

/* ===== TASK ITEMS ===== */
.task-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--border); flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; transition: background .2s, border-color .2s;
  font-size: 11px; color: #fff;
}
.task-check.done { background: var(--success); border-color: var(--success); }
.task-title { font-size: 13px; color: var(--text-primary); }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ===== FAQ ===== */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.faq-q { padding: 14px 16px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; transition: background .2s; gap: 12px; }
.faq-q:hover { background: var(--bg-hover); }
.faq-q .arrow { transition: transform .3s; color: var(--text-muted); flex-shrink: 0; }
.faq-item.open .faq-q .arrow { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.faq-item.open .faq-a { max-height: 400px; }
.faq-a-inner { padding: 0 16px 14px; font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.faq-category { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 8px; margin-left: 8px; font-weight: 600; }

/* ===== ADMIN ===== */
.settings-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .8px; }

/* ===== ACTIVITY FEED ===== */
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.activity-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== CHART HELPERS ===== */
.chart-legend { display: flex; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.donut-legend { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.donut-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.donut-row span { display: flex; align-items: center; gap: 6px; }
.dot-lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ====== Dashbioard Widgets ====== */

.clock-widget {
  display:flex; flex-direction:column; align-items:flex-end;
  padding:10px 16px; background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); margin-bottom:16px;
}
#live-clock { font-size:32px; font-weight:800; letter-spacing:2px; color:var(--accent); font-variant-numeric:tabular-nums; }
#live-date  { font-size:12px; color:var(--text-muted); margin-top:2px; }

.timer-card {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 16px; background:var(--bg-primary); border-radius:8px;
  border:1px solid var(--border); margin-bottom:8px;
}
.timer-digits { display:flex; align-items:center; gap:4px; flex-shrink:0; }
.timer-unit   { display:flex; flex-direction:column; align-items:center; gap:1px; }
.timer-num    { font-size:20px; font-weight:800; color:var(--text-primary); font-variant-numeric:tabular-nums; line-height:1; }
.timer-label  { font-size:8px; color:var(--text-muted); letter-spacing:.6px; }
.timer-sep    { font-size:18px; font-weight:700; color:var(--text-muted); margin-bottom:8px; }

.alert-item {
  display:flex; align-items:flex-start; gap:12px;
  padding:12px; border-radius:8px; margin-bottom:6px;
  cursor:pointer; transition:background .2s; border:1px solid transparent;
}
.alert-item.unread { background:var(--bg-primary); }
.alert-item.read   { background:transparent; opacity:.7; }
.alert-item:hover  { background:var(--bg-hover) !important; opacity:1; }
.alert-item.alert-critical { border-color:rgba(247,79,79,.2); }
.alert-item.alert-warning  { border-color:rgba(247,201,79,.15); }
.alert-item.alert-info     { border-color:rgba(79,142,247,.1); }
.alert-icon  { font-size:20px; flex-shrink:0; margin-top:1px; }
.alert-title { font-size:13px; font-weight:600; display:flex; align-items:center; gap:6px; }
.alert-dot   { width:7px; height:7px; background:var(--accent); border-radius:50%; display:inline-block; }
.alert-msg   { font-size:12px; color:var(--text-secondary); margin-top:3px; line-height:1.4; }
.alert-time  { font-size:11px; color:var(--text-muted); margin-top:4px; }

.weather-card {
  display:flex; align-items:center; gap:10px;
  padding:12px 16px; background:var(--bg-card);
  border:1px solid var(--border); border-radius:var(--radius);
  min-width:160px; flex-shrink:0;
}
.weather-icon { font-size:28px; }
#weather-strip {
  display:flex; gap:10px; overflow-x:auto; padding-bottom:4px; margin-bottom:16px;
}
#weather-strip::-webkit-scrollbar { height:4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .grid-cols-6-4, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .header-actions .search-box { display: none; }
}

@media (max-width: 600px) {
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow);
  }
  #sidebar.mobile-open { transform: translateX(0); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  #content { padding: 12px; }
  .cal-cell { min-height: 54px; }
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .doc-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .filter-bar { gap: 8px; }
  .page-title { font-size: 17px; }
}

/* ============================================================
   FedDeploy — Mobile Responsive additions
   Paste at the bottom of css/main.css
   ============================================================ */

@media (max-width: 768px) {

  /* App layout — full width when sidebar hidden */
  #app  { flex-direction: column; }
  #main { width: 100%; min-width: 0; }

  /* Header — tighten up on small screens */
  #header {
    padding: 0 10px;
    height: 50px;
    gap: 6px;
  }

  /* Hide less-important header actions on mobile */
  #header .search-box { display: none; }
  #header .hbtn:not(:first-of-type) { display: none; }

  /* Keep notification bell + cmd palette + avatar */
  #header .header-actions { gap: 6px; }
  .user-name { display: none; }       /* show avatar only */
  .user-chip { padding: 4px; border-radius: 50%; }

  /* Breadcrumb shorter */
  .breadcrumb span:not(.current) { display: none; }
  .breadcrumb { font-size: 13px; font-weight: 700; color: var(--text); }

  /* Page titles */
  .page-title    { font-size: 16px; }
  .page-subtitle { font-size: 11px; }

  /* Content padding */
  #content { padding: 14px 12px; }

  /* Stat/KPI grids — 2 col on mobile */
  .stat-grid,
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }

  /* Analytics grid — single column */
  .analytics-grid { grid-template-columns: 1fr !important; }

  /* Span overrides */
  [style*="grid-column:span"] { grid-column: span 1 !important; }

  /* Member grid — single col */
  .member-grid { grid-template-columns: 1fr !important; }

  /* Filter bar — stack vertically */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-bar .search-box { width: 100% !important; }
  .filter-bar select      { width: 100% !important; }
  .filter-bar .btn        { margin-left: 0 !important; }

  /* Tabs — scrollable row */
  .tabs {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; flex-wrap: nowrap;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }

  /* Modals — full screen on mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    width: 100%;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  /* Tables — horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Org chart members grid */
  .oc-members-grid { grid-template-columns: 1fr !important; padding-left: 16px; }
  .hq-row          { flex-direction: column; }
  .oc-lead-card    { max-width: 100%; }

  /* Detail slide-over — full width */
  #detail-panel { width: 100% !important; right: -100% !important; }
  #detail-panel.open { right: 0 !important; }
}

/* Extra small (phones < 390px) */
@media (max-width: 390px) {
  .stat-grid,
  .kpi-grid { grid-template-columns: 1fr !important; }
}