/* Palette ported 1:1 from the real Apps Script tool's MainDashboard.html
   :root block, so this app's colors match it exactly rather than just
   approximating navy/blue/etc with our own close-but-different shades. */
:root {
  --navy: #17335c;
  --navy-light: #1f4a85;
  --blue: #2563eb;
  --green: #0f9d58;
  --purple: #7c3aed;
  --orange: #d97706;
  --red: #dc2626;
  --teal: #0d9488;
  --amber: #ca8a04;
  --gray-bg: #eef1f6;
  --gray-border: #dfe3ea;
  --gray-text: #6b7280;
  --card-radius: 10px;
}
* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: var(--gray-bg); margin: 0; padding: 0; color: #1f2937; font-size: 13px; }
a { color: var(--blue); }

.env-banner {
  background: #b45309; color: white; text-align: center; padding: 6px; font-size: 12px;
  font-weight: 700; letter-spacing: 0.05em;
}

/* Topbar - matches the real tool's own .topbar (title+badge left,
   search+action buttons right) as closely as this app's extra
   cross-dashboard nav (logo, Admin Tool, log out) allows; those are
   the only intentional additions beyond the source's own layout. */
.header {
  background: var(--navy); color: white; padding: 10px 20px; font-size: 16px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-logo { height: 24px; width: auto; display: block; }
.header-links { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 500; }
.header a { color: white; text-decoration: none; border: 1px solid rgba(255,255,255,0.4); border-radius: 6px; padding: 6px 12px; }
.header a:hover { background: rgba(255,255,255,0.1); }
.header a.active { background: rgba(255,255,255,0.28); border-color: white; font-weight: 700; }
.header .badge { background: rgba(255,255,255,0.15); border-radius: 14px; padding: 3px 10px; font-size: 11px; font-weight: 500; }
.header .meta { font-size: 11px; opacity: 0.8; margin-right: 4px; }

/* .btn - ported 1:1 from the source's own .btn/.btn.secondary, used
   for the topbar's Approve & Lock / Upload Cycle File buttons and
   (our own addition) Dashboards/Admin Tool/Log out. */
.btn { background: var(--navy-light); color: white; border: none; border-radius: 6px; padding: 7px 14px; font-size: 12px; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-block; }
.btn:hover { background: #2a5aa0; }
.btn.secondary { background: white; color: var(--navy); border: 1px solid var(--gray-border); }
.btn.green { background: var(--green); border-color: var(--green); }
.btn-sm { padding: 5px 10px; font-size: 11px; }

.breadcrumbs { font-size: 13px; color: var(--gray-text); margin-bottom: 12px; }
.breadcrumbs a { color: var(--blue); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 6px; }
.breadcrumb-current { color: #1f2937; font-weight: 600; }

.pagination { display: flex; align-items: center; gap: 16px; margin-top: 12px; font-size: 13px; }
.pagination a { color: var(--blue); text-decoration: none; }
.pagination a:hover { text-decoration: underline; }
.pagination .disabled { color: #9ca3af; }
.pagination-status { color: var(--gray-text); }
.user-menu { position: relative; }
.user-menu-toggle { display: flex; align-items: center; gap: 4px; }
.user-menu-caret { font-size: 10px; }
.user-menu-panel {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: white; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  overflow: hidden; z-index: 60; min-width: 160px;
}
.user-menu-panel.open { display: block; }
.user-menu-panel a { display: block; color: #1f2937; text-decoration: none; border: none; border-radius: 0; padding: 10px 14px; font-size: 13px; }
.user-menu-panel a:hover { background: #f1f5f9; }

.header-search { position: relative; flex: 1; max-width: 260px; margin: 0 14px; }
.header-search input {
  width: 100%; padding: 7px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12); color: white; font-size: 13px;
}
.header-search input::placeholder { color: rgba(255,255,255,0.7); }
.header-search input:focus { outline: none; background: white; color: #1f2937; }
.header-search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: white; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); overflow: hidden; z-index: 50;
  max-height: 320px; overflow-y: auto;
}
.header-search-item { padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: #1f2937; }
.header-search-item:hover, .header-search-item.active { background: #eef2ff; }
.header-search-name { font-size: 13px; font-weight: 600; }
.header-search-meta { font-size: 11px; color: var(--gray-text); }
.header-search-empty { padding: 10px 12px; font-size: 12px; color: var(--gray-text); }

.container { max-width: 1100px; margin: 32px auto; padding: 0 20px 60px; }
.container-dashboard { max-width: 1500px; margin: 0 auto; padding: 18px 20px 40px; transition: max-width 0.15s ease; }
.container-dashboard.container-wide { max-width: 98vw; }
.muted { color: var(--gray-text); font-size: 13px; }

.box { max-width: 480px; margin: 60px auto; background: white; border-radius: 10px; padding: 32px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.box.centered { text-align: center; }
.button { display: inline-block; margin-top: 12px; background: var(--blue); color: white; text-decoration: none; padding: 10px 18px; border-radius: 6px; font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.card { text-decoration: none; background: white; border: 1px solid var(--gray-border); border-radius: 10px; padding: 24px; transition: box-shadow 0.15s; display: block; }
.card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.10); }
.card-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.card-subtitle { font-size: 12px; color: var(--gray-text); margin-top: 4px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.stat-card { background: white; border: 1px solid var(--gray-border); border-top: 3px solid var(--blue); border-radius: var(--card-radius); padding: 12px 14px; cursor: default; }
.stat-label { font-size: 10.5px; color: var(--gray-text); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.stat-value { font-size: 21px; font-weight: 700; color: #111827; margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--gray-text); margin-top: 2px; }
/* Color-coding utility classes, matching the real tool's
   .card.green/.purple/.orange/.navy/.red classes 1:1 - default (no
   class) is blue, same as its uncolored .card. */
.stat-card.navy { border-top-color: var(--navy); }
.stat-card.green { border-top-color: var(--green); }
.stat-card.purple { border-top-color: var(--purple); }
.stat-card.orange { border-top-color: var(--orange); }
.stat-card.red { border-top-color: var(--red); }
.stat-card.black { border-top-color: #111827; }

.dash-tabs { background: white; display: flex; gap: 4px; border-bottom: 1px solid var(--gray-border); margin: 0 -20px 16px; padding: 0 20px; }
.dash-tab-btn { background: none; border: none; padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--gray-text); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dash-tab-btn:hover { color: var(--navy); }
.dash-tab-btn.active { color: var(--navy); border-bottom-color: var(--blue); }
.dash-tab-panel { display: none; }
.dash-tab-panel.active { display: block; }


.tab-notes-cell { min-width: 220px; }
.notes-list-compact { list-style: none; margin: 0 0 6px; padding: 0; font-size: 12px; }
.notes-list-compact li { margin-bottom: 4px; }
.tab-note-form { display: flex; gap: 6px; }
.tab-note-form input[type="text"] { flex: 1; min-width: 120px; padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; }

.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.hint { font-size: 10.5px; font-weight: 400; color: var(--gray-text); text-transform: none; margin-left: 6px; }
.info-only-badge { display: inline-block; background: #fee2e2; color: var(--red); border-radius: 8px; padding: 1px 6px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; margin-left: 4px; }
.total-row td { border-top: 2px solid var(--gray-border); background: #f8fafc; }
.link-inline { color: var(--blue); cursor: pointer; text-decoration: underline; white-space: nowrap; }
.link-inline:hover { color: #1d4ed8; }
.perf-pay-rating-row { margin-bottom: 16px; }
.perf-pay-bar-track { flex: 1; background: #f1f3f6; border-radius: 3px; height: 16px; overflow: hidden; }
.perf-pay-bar-fill { height: 100%; }
.perf-pay-chart-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; cursor: pointer; }
.perf-pay-vbar-col { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.perf-pay-vbar-col + .perf-pay-vbar-col { border-left: 1px solid var(--gray-border); }
.perf-pay-vbar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 34px; flex-shrink: 0; cursor: pointer; }

.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eef0f3; font-size: 13px; white-space: nowrap; }
.data-table th { background: #f0f2f5; font-weight: 700; color: #374151; }
.data-table tr:hover td { background: #f8fafc; }

/* Wraps a table so a wide (many columns) or long (many rows) result
   set scrolls within its own box instead of stretching the page. */
.table-scroll { overflow: auto; max-height: 70vh; border-radius: 8px; }
.table-scroll .data-table, .table-scroll .mini-table { border-radius: 0; }
.table-scroll .data-table th, .table-scroll .mini-table th { position: sticky; top: 0; z-index: 1; }

.banner { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.banner.locked { background: #fef3c7; border-color: #fde68a; }
.inline-form { display: inline; }

.note-form { display: flex; gap: 8px; margin: 12px 0; align-items: flex-start; }
.note-form textarea { flex: 1; min-height: 40px; padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; }
.notes-list { list-style: none; padding: 0; }
.notes-list li { background: white; border: 1px solid var(--gray-border); border-radius: 6px; padding: 10px 14px; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.note-type { font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--blue); }
.note-text { flex: 1; }
.note-meta { font-size: 11px; color: #9ca3af; }
.link-button { background: none; border: none; color: var(--red); cursor: pointer; font-size: 12px; padding: 0; }

/* Filter bar - ported from the source's own .filter-bar/.ms-filter
   (a bordered white card of pill-shaped multi-select toggles). */
.filter-bar { display: flex; gap: 8px; padding: 12px 16px; background: white; border: 1px solid var(--gray-border); border-radius: var(--card-radius); margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.filter-bar label { font-size: 11.5px; color: var(--gray-text); font-weight: 600; margin-right: 2px; }
.search-box { padding: 5px 8px; border: 1px solid var(--gray-border); border-radius: 6px; font-size: 12px; min-width: 220px; }
.filter-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-group { position: relative; }
.filter-toggle { background: white; border: 1px solid var(--gray-border); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.filter-toggle:hover { background: #f8fafc; }
.filter-count { color: var(--blue); font-weight: 700; }
.filter-options { display: none; position: absolute; top: 100%; left: 0; z-index: 10; background: white; border: 1px solid var(--gray-border); border-radius: 8px; padding: 8px; margin-top: 4px; max-height: 240px; overflow-y: auto; min-width: 180px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.filter-options.open { display: block; }
.filter-option { display: block; font-size: 12px; padding: 3px 2px; white-space: nowrap; cursor: pointer; }
.filter-option:hover { background: #f8fafc; }
.filter-count-label { font-size: 12px; color: var(--gray-text); }

.data-table th[data-sort-key] { cursor: pointer; user-select: none; }
.data-table th[data-sort-key]:hover { background: #e5e8ec; }
.data-table th.sort-asc::after { content: " \25B2"; font-size: 10px; }
.data-table th.sort-desc::after { content: " \25BC"; font-size: 10px; }

.pool-note { font-size: 11px; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 6px; padding: 6px 10px; margin: 16px 0 4px; }

.summary-controls { display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; flex-wrap: wrap; }
.btn-view-by { background: white; border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-view-by.active { background: var(--navy); color: white; border-color: var(--navy); }
.btn-view-by:hover:not(.active) { border-color: #9ca3af; }

#summaryTableWrap .data-table td.drillable { cursor: pointer; color: var(--blue); text-decoration: underline; }
#summaryTableWrap .data-table td.drillable:hover { background: #eef2ff; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-overlay-stacked { z-index: 105; }
.modal-box { background: white; border-radius: 10px; max-width: 480px; max-height: 70vh; width: 90%; overflow: hidden; display: flex; flex-direction: column; }
.modal-box-wide { max-width: 860px; max-height: 85vh; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--gray-border); font-weight: 700; }
.modal-body { padding: 10px 18px; overflow-y: auto; }
.modal-box-wide .modal-body { padding: 16px 22px 22px; }
.modal-body table { width: 100%; border-collapse: collapse; }
.modal-body th, .modal-body td { padding: 6px 14px; border-bottom: 1px solid #f0f2f5; font-size: 13px; white-space: nowrap; }

.mini-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; font-size: 12px; }
.mini-table th, .mini-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid #eef0f3; white-space: nowrap; }
.mini-table th { background: #f0f2f5; font-weight: 700; color: #374151; }
.empty-state { color: #9ca3af; font-size: 13px; padding: 16px; background: white; border: 1px solid var(--gray-border); border-radius: 8px; }
.lti-toggle-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; margin: 8px 0; align-items: center; }
.lti-toggle-row label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

.panel { background: white; border: 1px solid var(--gray-border); border-radius: var(--card-radius); overflow: hidden; margin-bottom: 14px; }
.panel-header { padding: 12px 16px; font-weight: 600; font-size: 13.5px; border-bottom: 1px solid var(--gray-border); display: flex; justify-content: space-between; align-items: center; }
.panel-header .hint { font-size: 11px; color: var(--gray-text); font-weight: 400; }
.panel .mini-table { border-radius: 0; }
details.panel summary::-webkit-details-marker { display: none; }

.emp-link { color: var(--blue); cursor: pointer; text-decoration: none; }
.emp-link:hover { text-decoration: underline; }

/* Employee profile side panel */
.profile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 110;
  justify-content: flex-end;
}
.profile-overlay.open { display: flex; }
.profile-panel {
  background: var(--gray-bg);
  width: 1050px;
  max-width: 95vw;
  height: 100%;
  overflow-y: auto;
  box-shadow: -6px 0 24px rgba(0,0,0,0.15);
}
.profile-header { background: var(--navy); color: white; padding: 18px 24px; position: sticky; top: 0; z-index: 5; }
.profile-header .top-row { display: flex; justify-content: space-between; align-items: flex-start; }
.profile-header .emp-name { font-size: 19px; font-weight: 700; }
.profile-header .emp-meta { font-size: 12px; opacity: 0.85; margin-top: 3px; }
.profile-close-btn { background: rgba(255,255,255,0.15); border: none; color: white; border-radius: 6px; width: 30px; height: 30px; font-size: 16px; cursor: pointer; }
.profile-close-btn:hover { background: rgba(255,255,255,0.28); }
.profile-body { padding: 18px 24px 40px; }
.emp-photo-placeholder {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-name-row { display: flex; align-items: center; gap: 18px; }
.header-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.3); }
.header-col-left { border-right: 1px solid rgba(255,255,255,0.2); padding-right: 24px; }
.header-col-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; margin-bottom: 8px; }
.profile-info-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.profile-info-grid .item .label { font-size: 10.5px; opacity: 0.7; text-transform: uppercase; }
.profile-info-grid .item .value { font-size: 13px; font-weight: 600; }
.cycle-mini-col { min-width: 64px; }
.cycle-mini-label { font-size: 10.5px; text-transform: uppercase; }
.cycle-mini-value { font-size: 15px; font-weight: 700; }
.cycle-mini-sub { font-size: 11px; }
.cycle-badge { display: inline-block; font-size: 11px; background: rgba(255,255,255,0.15); color: white; border-radius: 4px; padding: 3px 8px; margin-right: 6px; }
.cycle-badge.positive { background: rgba(22,163,74,0.35); }
.cycle-badge.warning { background: rgba(249,115,22,0.35); }
