/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Lato', 'Montserrat', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bord2); border-radius: 3px; }

/* ── CSS Variables ── */
:root {
  --bg:   #0f1117;
  --surf: #1a1c20;
  --surf2: #202328;
  --surf3: #252830;
  --bord: #2e3038;
  --bord2: #3a3d46;
  --acc: #4a7fd4;
  --acc2: #6b9fe8;
  --acc3: #2d5aaa;
  --text: #e8e6df;
  --text1: #f0ede6;
  --text2: #b8b5ae;
  --mut: #7a8199;
  --dan: #c25c5c;
  --suc: #5cb87a;
  --warn: #c89b3c;
  --inf: #5c8ec2;
  --g6: #3cbf88;   /* excellent  */
  --g5: #44a46e;   /* good       */
  --g4: #8a9ab5;   /* normal     */
  --g3: #c89b3c;   /* concerning */
  --g2: #d47040;   /* very concerning */
  --g1: #e05555;   /* critical   */
  --r: 6px;
  --rl: 12px;
  --rxl: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.5);
  --shadow-sm: 0 2px 12px rgba(0,0,0,.35);
}

/* ── Light / Emydex-branded theme ── */
[data-theme="light"] {
  --bg:        #f0f4f8;
  --surf:      #ffffff;
  --surf2:     #f4f6fb;
  --surf3:     #eaecf4;
  --bord:      #cfd5e8;
  --bord2:     #b0b8d0;
  --acc:       #1f3f7c;   /* Emydex primary navy */
  --acc2:      #2d5aaa;
  --acc3:      #163060;
  --text:      #1a2035;
  --text1:     #0d1528;
  --text2:     #4a5570;
  --mut:       #6a7590;
  --dan:       #b83030;
  --suc:       #3bb44a;   /* Emydex green */
  --warn:      #a06800;
  --inf:       #2d70b0;
  --g6: #3cbf88; --g5: #44a46e; --g4: #6a7590;
  --g3: #c89b3c; --g2: #d47040; --g1: #e05555;
  --shadow:    0 4px 24px rgba(31,63,124,.12);
  --shadow-sm: 0 2px 12px rgba(31,63,124,.08);
}

/* Emydex navy sidebar in light mode */
[data-theme="light"] .sidebar {
  background: #1f3f7c;
  border-right-color: #163060;
}
[data-theme="light"] .brand { border-bottom-color: rgba(255,255,255,.12); }
[data-theme="light"] .brand-eye { color: #acc039; }
[data-theme="light"] .brand-name,
[data-theme="light"] .brand-ver { color: rgba(255,255,255,.9); }
[data-theme="light"] .brand-ver { color: rgba(255,255,255,.45); font-size: 10px; }
[data-theme="light"] .nav-section { color: rgba(255,255,255,.4); border-color: transparent; }
[data-theme="light"] .nav-item { color: rgba(255,255,255,.72); border-color: transparent; }
[data-theme="light"] .nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
[data-theme="light"] .nav-item.active { background: rgba(172,192,57,.18); color: #acc039; border-color: rgba(172,192,57,.4); }
[data-theme="light"] .nav-item .nav-icon { color: inherit; }
[data-theme="light"] .sidebar-footer { border-top-color: rgba(255,255,255,.12); }
[data-theme="light"] .user-chip { background: rgba(255,255,255,.07); }
[data-theme="light"] .user-name { color: #fff; }
[data-theme="light"] .user-role { color: rgba(255,255,255,.55); }
[data-theme="light"] .logout-btn { border-color: rgba(255,255,255,.2); color: rgba(255,255,255,.65); }
[data-theme="light"] .logout-btn:hover { border-color: #f08080; color: #f08080; }
[data-theme="light"] .theme-toggle { border-color: rgba(255,255,255,.2); color: rgba(255,255,255,.65); }
[data-theme="light"] .theme-toggle:hover { border-color: #acc039; color: #acc039; }

/* Topbar accent stripe */
[data-theme="light"] .topbar {
  border-bottom-color: #cfd5e8;
  background: #fff;
}
[data-theme="light"] .topbar::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, #1f3f7c, #2d5aaa, #8eccbb, #ccd735, #acc039);
}
[data-theme="light"] .topbar { position: relative; }

/* ── Theme toggle button ── */
.theme-toggle {
  display: flex; align-items: center; gap: .5rem;
  width: 100%;
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .38rem .7rem;
  margin-bottom: .45rem;
  font-size: 12px; font-family: inherit;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
}
.theme-toggle:hover { border-color: var(--acc); color: var(--acc); }
.theme-toggle i { font-size: 14px; }

/* ── Layout ── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surf);
  border-right: 1px solid var(--bord);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width .2s;
}
.brand {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid var(--bord);
}
.brand-eye {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--acc);
  font-weight: 600;
}
.brand-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.25rem;
  color: var(--text);
  line-height: 1.2;
  margin-top: .3rem;
}
.brand-ver {
  font-size: 11px;
  color: var(--mut);
  margin-top: .2rem;
}
.nav-section {
  padding: .85rem .9rem .3rem;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1rem;
  margin: .12rem .5rem;
  border-radius: var(--r);
  font-size: 15px;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  user-select: none;
}
.nav-item:hover { background: var(--surf2); color: var(--text); }
.nav-item.active { background: rgba(74,127,212,.12); color: var(--acc); border-color: rgba(74,127,212,.22); }
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--bord);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .65rem;
  border-radius: var(--r);
  background: var(--surf2);
  border: 1px solid var(--bord);
  margin-bottom: .5rem;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--acc), var(--inf));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 500; color: var(--text); }
.user-role { font-size: 12px; color: var(--mut); }
.logout-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .38rem;
  font-family: inherit;
  font-size: 12px;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
}
.logout-btn:hover { border-color: var(--dan); color: var(--dan); }

/* ── Main content ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.topbar {
  background: var(--surf);
  border-bottom: 1px solid var(--bord);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: .75rem;
}
.topbar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1;
}
.topbar-sub { font-size: 13px; color: var(--mut); margin-top: .2rem; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.month-select {
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .38rem .7rem;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.month-select:focus { border-color: var(--acc); }

/* ── Content area ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.5rem;
}
.page { display: none; }
.page.active { display: block; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: 11px;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 20px;
  letter-spacing: .02em;
}
.badge-gold   { background: rgba(200,169,110,.15); color: #c8a96e;     border: 1px solid rgba(200,169,110,.3); }
.badge-danger { background: rgba(194,92,92,.15);  color: var(--dan);  border: 1px solid rgba(194,92,92,.3); }
.badge-success{ background: rgba(92,184,122,.15); color: var(--suc);  border: 1px solid rgba(92,184,122,.3); }
.badge-warning{ background: rgba(200,155,60,.15); color: var(--warn); border: 1px solid rgba(200,155,60,.3); }
.badge-info   { background: rgba(92,142,194,.15); color: var(--inf);  border: 1px solid rgba(92,142,194,.3); }
.badge-muted  { background: rgba(122,129,153,.1); color: var(--mut);  border: 1px solid var(--bord); }
.badge-mand   { background: rgba(194,92,92,.12);  color: #e88;        border: 1px solid rgba(194,92,92,.3); }
.badge-team   { background: rgba(92,142,194,.12); color: var(--inf);  border: 1px solid rgba(92,142,194,.25); }
.badge-add-team    { background: rgba(92,184,122,.12); color: var(--suc);  border: 1px solid rgba(92,184,122,.3);  cursor: pointer; }
.badge-remove-team { background: rgba(194,92,92,.08);  color: var(--dan);  border: 1px solid rgba(194,92,92,.25); cursor: pointer; }
.badge-add-team:hover    { background: rgba(92,184,122,.22); }
.badge-remove-team:hover { background: rgba(194,92,92,.18); }

/* ── Cards ── */
.card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  padding: 1.1rem 1.2rem;
}
.card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mut);
  font-weight: 600;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.card-title i { color: var(--acc); font-size: 15px; }
.card-big {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.4rem;
  color: var(--text);
  line-height: 1;
}
.card-sub { font-size: 13px; color: var(--mut); margin-top: .3rem; }

/* ── Grids ── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }

/* ── Dashboard tile row ── */
.tile-row { display: grid; grid-template-columns: 1.6fr 1fr repeat(6, 1fr); gap: .75rem; margin-bottom: 1rem; }
.tile { border-radius: 10px; padding: .8rem 1rem; display: flex; flex-direction: column; min-height: 88px; }
.tile-metric { background: var(--surf); border: 1px solid var(--bord); }
.tile-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); display: flex; align-items: center; gap: 4px; }
.tile-label i { font-size: 12px; color: var(--acc); }
.tile-big { font-family: 'Montserrat', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--text); line-height: 1.1; margin-top: .25rem; }
.tile-sub { font-size: 11px; color: var(--mut); margin-top: .15rem; }
.tile-rating { color: #fff; align-items: center; justify-content: center; text-align: center; gap: 2px; }
.tile-rating .tile-label { color: rgba(255,255,255,.8); justify-content: center; font-size: 9px; letter-spacing: .07em; }
.tile-rating .tile-big { font-size: 2.2rem; color: #fff; margin-top: 0; text-shadow: 0 1px 4px rgba(0,0,0,.25); }
.tile-rating .tile-sub { color: rgba(255,255,255,.6); font-size: 10px; margin-top: 0; }
.tile-g6 { background: linear-gradient(145deg, #4fd49a, #1e9060); box-shadow: 0 3px 10px rgba(60,191,136,.35); }
.tile-g5 { background: linear-gradient(145deg, #56b87e, #1e7040); box-shadow: 0 3px 10px rgba(68,164,110,.35); }
.tile-g4 { background: linear-gradient(145deg, #90a8c4, #506080); box-shadow: 0 3px 10px rgba(100,130,170,.35); }
.tile-g3 { background: linear-gradient(145deg, #d8aa50, #906818); box-shadow: 0 3px 10px rgba(200,155,60,.35); }
.tile-g2 { background: linear-gradient(145deg, #e08858, #b04820); box-shadow: 0 3px 10px rgba(212,112,64,.35); }
.tile-g1 { background: linear-gradient(145deg, #e86868, #b02020); box-shadow: 0 3px 10px rgba(224,85,85,.35); }

/* ── Standout scores band rows ── */
.sband-row { margin-bottom: .75rem; }
.sband-row:last-child { margin-bottom: 0; }
.sband-header { display: flex; align-items: center; gap: 6px; margin-bottom: .4rem; }
.sband-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sband-label { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.sband-rule { flex: 1; height: 1px; background: var(--bord); }
.sband-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 14px; }
.sband-chip { display: flex; align-items: center; gap: 5px; background: var(--surf2); border-radius: 20px; padding: 3px 8px 3px 4px; }
.sband-chip-name { font-size: 12px; color: var(--text); }
.sband-chip-count { font-size: 11px; font-weight: 600; color: var(--mut); }

/* ── Progress bar ── */
.progress-track { height: 3px; background: var(--bord); border-radius: 2px; margin-top: .8rem; }
.progress-fill  { height: 100%; border-radius: 2px; background: var(--acc); transition: width .4s; }

/* ── Bell curve bars ── */
.bell-wrap { display: flex; align-items: flex-start; gap: 4px; margin-top: .7rem; }
.bell-col  { display: flex; flex-direction: column; align-items: center; flex: 1; }
.bell-col-bars { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 56px; width: 100%; gap: 2px; }
.bell-bar  { width: 100%; border-radius: 3px 3px 0 0; transition: height .4s; }
.bell-lbl  { font-size: 9px; color: var(--mut); }
.bell-val  { font-size: 9px; color: var(--text); }

/* ── Stat rows (dashboard lists) ── */
.stat-row { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--bord); }
.stat-row:last-child { border-bottom: none; }
.stat-name { font-size: 15px; color: var(--text); }
.stat-meta { font-size: 12px; color: var(--mut); margin-top: .1rem; }
.score-pill {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
  color: #fff;
  border: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.sp6 { background: linear-gradient(145deg,#4fd49a,#28a070); box-shadow: 0 2px 8px rgba(60,191,136,.55), inset 0 1px 0 rgba(255,255,255,.3); }
.sp5 { background: linear-gradient(145deg,#56b87e,#2e8a54); box-shadow: 0 2px 8px rgba(68,164,110,.55), inset 0 1px 0 rgba(255,255,255,.25); }
.sp4 { background: linear-gradient(145deg,#8fa4be,#607085); box-shadow: 0 2px 8px rgba(100,130,170,.5),  inset 0 1px 0 rgba(255,255,255,.25); }
.sp3 { background: linear-gradient(145deg,#e07878,#c04848); box-shadow: 0 2px 8px rgba(200,80,80,.5),    inset 0 1px 0 rgba(255,255,255,.3); }
.sp2 { background: linear-gradient(145deg,#cc3a3a,#a01818); box-shadow: 0 2px 8px rgba(180,40,40,.55),   inset 0 1px 0 rgba(255,255,255,.25); }
.sp1 { background: linear-gradient(145deg,#a81818,#6e0404); box-shadow: 0 2px 8px rgba(140,20,20,.6),    inset 0 1px 0 rgba(255,255,255,.2); }

/* ── Trend bars ── */
.trend-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.trend-label { font-size: 12px; color: var(--mut); width: 64px; flex-shrink: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.trend-track { flex: 1; height: 5px; background: var(--surf2); border-radius: 3px; }
.trend-fill  { height: 100%; border-radius: 3px; transition: width .4s; }
.trend-val   { font-size: 12px; color: var(--text); width: 28px; text-align: right; flex-shrink: 0; }

/* ── Action rows ── */
.action-row { display: flex; align-items: center; gap: .65rem; padding: .55rem 0; border-bottom: 1px solid var(--bord); }
.action-row:last-child { border-bottom: none; }
.action-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: .4rem; }
.action-desc { font-size: 13px; color: var(--text); }
.action-meta { font-size: 11px; color: var(--mut); margin-top: .15rem; }

/* ── Manager rate page sections ── */
.rate-section-header {
  display: flex;
  align-items: center;
  margin-bottom: .65rem;
}
.rate-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .03em;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.rate-section-divider {
  height: 1px;
  background: var(--bord);
  margin: 1.25rem 0 1rem;
}

/* ── Rate page toolbar ── */
.rate-toolbar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
  align-items: center;
}
.search-input {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .42rem .8rem;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  flex: 1;
  min-width: 160px;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--acc); }
.filter-btn {
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .38rem .75rem;
  font-family: inherit;
  font-size: 12px;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.filter-btn:hover { border-color: var(--acc); color: var(--acc); }
.filter-btn.active { border-color: var(--acc); color: var(--acc); background: rgba(74,127,212,.08); }
.filter-btn.active-mand { border-color: #e88; color: #e88; background: rgba(194,92,92,.08); }
.filter-btn.active-team { border-color: var(--inf); color: var(--inf); background: rgba(92,142,194,.08); }
.view-btn {
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .38rem .55rem;
  font-size: 14px;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
}
.view-btn:hover { border-color: var(--acc); color: var(--acc); }
.view-btn.active { border-color: var(--acc); color: var(--acc); background: rgba(74,127,212,.08); }
.rate-info { font-size: 12px; color: var(--mut); margin-bottom: .8rem; }

/* ── Employee cards (card view) ── */
.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .75rem;
}
.emp-card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  padding: .9rem;
  transition: border-color .15s;
  position: relative;
}
.emp-card:hover { border-color: rgba(74,127,212,.35); }
.emp-card.is-rated { border-color: rgba(92,184,122,.35); }
.emp-card.is-mandatory { border-left: 2.5px solid rgba(194,92,92,.65); }
.emp-card-exit { animation: cardExit .28s ease forwards; pointer-events: none; }
@keyframes cardExit {
  0%   { opacity: 1; transform: scale(1)    translateY(0); }
  100% { opacity: 0; transform: scale(0.92) translateY(-12px); }
}
.emp-card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .65rem; }
.emp-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surf2);
  border: 1px solid var(--bord);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--acc);
  flex-shrink: 0;
}
.emp-name { font-size: 15px; font-weight: 500; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.emp-name-link { cursor: pointer; }
.emp-name-link:hover { color: var(--acc); text-decoration: underline; }
.emp-profile-nav { display: flex; align-items: center; gap: .5rem; }
.emp-profile-nav .nav-counter { font-size: 0.85rem; color: var(--mut); min-width: 3.5rem; text-align: center; }
.wl-comment-ta { width: 100%; resize: vertical; min-height: 3rem; font-size: 13px; padding: .35rem .5rem; border: 1px solid var(--bord); border-radius: var(--radius-sm); background: var(--surf); color: var(--text1); font-family: inherit; }
.wl-comment-ta:focus { outline: none; border-color: var(--acc); }
.wl-comment-ta.input-error { border-color: var(--danger); }
.emp-meta { font-size: 13px; color: var(--mut); }
.emp-badge-row { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .55rem; min-height: 18px; }
.autosave-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--suc);
  position: absolute;
  top: .6rem; right: .6rem;
  opacity: 0;
  transition: opacity .3s;
}
.autosave-dot.show { opacity: 1; }

/* ── Score stars ── */
.score-row { display: flex; gap: 5px; margin-bottom: .4rem; flex-wrap: wrap; }
.score-btn {
  min-width: 28px; height: 25px; padding: 0 4px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--bord);
  background: var(--surf2);
  color: var(--mut);
  transition: all .12s;
  user-select: none;
  font-family: 'Montserrat', sans-serif;
}
.score-btn:hover { border-color: var(--acc); color: var(--acc); }
.score-btn.selected { font-weight: 700; }
.comment-area {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .4rem .6rem;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 72px;
  overflow: hidden;
  outline: none;
  margin-top: .25rem;
  transition: border-color .15s;
}
.comment-area:focus { border-color: var(--acc); }
.comment-area.comment-required { border-color: var(--dan); }
.comment-area.comment-required:focus { border-color: var(--dan); }
.card-reset-btn {
  display: none; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--bord); border-radius: var(--r);
  color: var(--mut); font-size: 13px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.emp-card.is-rated .card-reset-btn,
.list-row.is-rated .card-reset-btn { display: flex; }
.card-reset-btn:hover { color: var(--dan); border-color: rgba(194,92,92,.5); }
.card-reset-btn:disabled { opacity: .4; cursor: not-allowed; }
.card-save-btn {
  display: none; align-items: center; gap: 4px;
  margin-top: 6px; margin-left: auto;
  padding: 5px 12px; border-radius: 6px;
  border: 1px solid rgba(68,164,110,.4);
  background: rgba(68,164,110,.08);
  color: #3a9e64; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.emp-card.is-editing .card-save-btn,
.emp-card:focus-within .card-save-btn { display: flex; }
.card-save-btn:hover { background: rgba(68,164,110,.18); border-color: rgba(68,164,110,.6); }
.card-save-btn:disabled { opacity: .5; cursor: not-allowed; }
.add-team-btn {
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .18rem .48rem;
  font-family: inherit;
  font-size: 11px;
  color: var(--mut);
  cursor: pointer;
  transition: all .12s;
}
.add-team-btn:hover { border-color: var(--inf); color: var(--inf); }

/* ── List view ── */
.list-wrap {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  overflow: hidden;
}
.list-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .9rem;
  background: var(--surf2);
  border-bottom: 1px solid var(--bord);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mut);
  font-weight: 600;
}
.lh-av { width: 38px; flex-shrink: 0; }
.lh-name { flex: 0 0 210px; }
.lh-score { flex: 0 0 146px; }
.lh-comment { flex: 1; }
.list-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--bord);
  transition: background .12s;
  border-left: 2.5px solid transparent;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(255,255,255,.015); }
.list-row.is-mandatory { border-left-color: rgba(194,92,92,.6); }
.list-row.is-rated { border-left-color: rgba(92,184,122,.45); }
.list-av {
  width: 38px; height: 38px;
  margin-top: 4px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surf2);
  border: 1px solid var(--bord);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  color: var(--acc);
  flex-shrink: 0;
}
.list-info { flex: 0 0 210px; min-width: 0; padding-top: 2px; }
.list-name { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.list-meta { font-size: 11px; color: var(--mut); }
.list-scores { display: flex; gap: 5px; flex: 0 0 160px; padding-top: 3px; }
.list-score-btn {
  min-width: 22px; height: 22px; padding: 0 3px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--bord);
  background: var(--surf2);
  color: var(--mut);
  transition: all .1s;
  user-select: none;
  font-family: 'Montserrat', sans-serif;
}
.list-score-btn:hover { border-color: var(--acc); color: var(--acc); }
.list-score-btn.selected { font-weight: 700; }
.list-comment {
  flex: 1;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .28rem .5rem;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  min-width: 0;
  min-height: 54px;
  overflow: hidden;
  resize: none;
  transition: border-color .15s;
}
.list-comment:focus { border-color: var(--acc); }
.list-comment.comment-required { border-color: var(--dan); }
.list-status { flex: 0 0 100px; display: flex; align-items: flex-start; justify-content: flex-end; gap: .35rem; padding-top: 3px; }
.saved-flash { font-size: 10px; color: var(--suc); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.saved-flash.show { opacity: 1; }

/* ── Data tables (admin pages) ── */
.table-wrap {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.data-table th {
  background: var(--surf2);
  padding: .65rem 1rem;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mut);
  font-weight: 600;
  border-bottom: 1px solid var(--bord);
}
.data-table td {
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--bord);
  color: var(--text);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.018); }

/* ── Buttons ── */
.btn-primary {
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: .48rem 1.1rem;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.btn-primary:hover { background: var(--acc2); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .45rem 1rem;
  font-family: inherit;
  font-size: 13px;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { border-color: var(--acc); color: var(--acc); }
.btn-icon {
  background: transparent;
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .3rem .6rem;
  font-size: 12px;
  color: var(--mut);
  cursor: pointer;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--acc); color: var(--acc); }
.btn-icon.danger:hover { border-color: var(--dan); color: var(--dan); }
.btn-icon.mand { border-color: rgba(194,92,92,.4); color: #e88; }
.btn-icon.team { border-color: rgba(92,142,194,.35); color: var(--inf); }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-field { margin-bottom: .75rem; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .3rem;
}
.form-input, .form-select {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .5rem .75rem;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--acc); }
.form-card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  padding: 1rem 1.1rem;
  margin-bottom: .85rem;
}

/* ── Lock warn ── */
.lock-warn {
  background: rgba(194,92,92,.1);
  border: 1px solid rgba(194,92,92,.3);
  border-radius: var(--r);
  padding: .55rem .9rem;
  color: var(--dan);
  font-size: 13px;
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Period Closed Page ── */
.period-closed-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
}
.period-closed-icon {
  font-size: 3rem;
  color: var(--dan);
  margin-bottom: 1.25rem;
}
.period-closed-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .65rem;
}
.period-closed-body {
  font-size: 14px;
  color: var(--mut);
  line-height: 1.7;
  max-width: 420px;
}

/* ── Email Preview Dialog ── */
.email-dialog-backdrop {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.email-dialog {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: calc(var(--r) * 2);
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  width: 100%; max-width: 640px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 3rem);
  animation: bladeIn .2s ease;
}
.email-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem .85rem;
  border-bottom: 1px solid var(--bord);
  font-size: 14px; font-weight: 600; color: var(--text);
}
.email-dialog-body {
  padding: 1rem 1.25rem;
  overflow-y: auto; flex: 1;
}
.email-dialog-body textarea {
  width: 100%; min-height: 340px;
  background: var(--bg2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .75rem;
  color: var(--text);
  font-family: monospace; font-size: 12px; line-height: 1.6;
  resize: vertical;
}
.email-dialog-body textarea:focus { outline: none; border-color: var(--acc); }
.email-dialog-footer {
  display: flex; gap: .5rem; justify-content: flex-end;
  padding: .85rem 1.25rem 1rem;
  border-top: 1px solid var(--bord);
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  backface-visibility: hidden;
  background: linear-gradient(135deg, #1e3d2a 0%, #163322 100%);
  border: 1px solid rgba(92,184,122,.5);
  border-radius: var(--r);
  padding: .65rem 1.4rem;
  color: #6ee89a;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(92,184,122,.15);
  z-index: 9999;
  animation: toastIn .25s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.err {
  background: linear-gradient(135deg, #3d1e1e 0%, #331616 100%);
  border-color: rgba(194,92,92,.5);
  color: #f08080;
  box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(194,92,92,.15);
}
@keyframes toastIn { from { opacity: 0; transform: translate3d(-50%, -8px, 0); } to { opacity: 1; transform: translate3d(-50%, 0, 0); } }

/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 55% 40%, #1a2040 0%, #0f1117 68%);
  padding: 2rem;
}
[data-theme="light"] .login-screen {
  background: #edf0f5;
}
.login-card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rxl);
  padding: 2.75rem 2.25rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
}
[data-theme="light"] .login-card {
  border-color: transparent;
  box-shadow: 0 8px 40px rgba(0,0,0,.11);
  text-align: center;
}
.login-logo { margin-bottom: 1.75rem; }
.login-logo-wordmark {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--acc);
  line-height: 1.2;
}
.login-logo-tag {
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--mut);
  text-transform: uppercase;
  margin-top: .3rem;
}
.login-title { font-family: 'Montserrat', sans-serif; font-size: 1.85rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: .6rem; }
.login-sub { color: var(--mut); font-size: 14px; margin-bottom: 1.75rem; line-height: 1.6; }
.login-label { display: block; font-size: 11px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .4rem; }
.login-input {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .72rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 1rem;
}
.login-input:focus { border-color: var(--acc); }
.login-btn {
  width: 100%;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: .88rem;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  letter-spacing: .02em;
}
.login-btn:hover { background: var(--acc2); }
.login-error {
  background: rgba(194,92,92,.1);
  border: 1px solid var(--dan);
  border-radius: var(--r);
  padding: .6rem .9rem;
  color: var(--dan);
  font-size: 12px;
  margin-bottom: .9rem;
}
.login-persist-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: .9rem;
  font-size: 12px;
  color: var(--mut);
}
.login-hint { font-size: 12px; color: var(--mut); margin-top: 1.2rem; line-height: 1.6; }
.login-hint strong { color: var(--acc); }
.login-footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bord);
  font-size: 12px;
  color: var(--mut);
  text-align: center;
}

/* ── Tab bar (People page and future tabbed pages) ── */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--bord);
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--mut);
  font-family: 'Lato', 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: .5rem .9rem .4rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--acc); border-bottom-color: var(--acc); }

/* ── Close month page ── */
.close-card { max-width: 520px; }
.section-title { font-family: 'Montserrat', sans-serif; font-size: 1.25rem; color: var(--text); margin-bottom: .4rem; }
.section-sub { font-size: 13px; color: var(--mut); line-height: 1.6; margin-bottom: 1rem; }
.divider { height: 1px; background: var(--bord); margin: 1rem 0; }
.month-lock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 0;
  border-bottom: 1px solid var(--bord);
}
.month-lock-row:last-child { border-bottom: none; }
.close-danger-btn {
  background: rgba(194,92,92,.1);
  border: 1px solid rgba(194,92,92,.35);
  border-radius: var(--r);
  padding: .38rem .85rem;
  font-family: inherit;
  font-size: 12px;
  color: var(--dan);
  cursor: pointer;
  transition: all .15s;
}
.close-danger-btn:hover { background: rgba(194,92,92,.2); }

/* ── Setup Wizard ── */
.setup-card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rxl);
  padding: 2.5rem 2.25rem;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow);
}
.wz-steps {
  display: flex;
  align-items: center;
  margin: 1.5rem 0 2rem;
}
.wz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}
.wz-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  transition: all .2s;
}
.wz-step-pending .wz-dot  { background: var(--surf2); border: 1px solid var(--bord); color: var(--mut); }
.wz-step-active  .wz-dot  { background: var(--acc);   border: 1px solid var(--acc);  color: #fff; }
.wz-step-done    .wz-dot  { background: rgba(92,184,122,.15); border: 1px solid var(--suc); color: var(--suc); }
.wz-label {
  font-size: 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
}
.wz-step-pending .wz-label { color: var(--mut); }
.wz-step-active  .wz-label { color: var(--acc); }
.wz-step-done    .wz-label { color: var(--suc); }
.wz-connector {
  flex: 1;
  height: 1px;
  background: var(--bord);
  margin: 0 .5rem;
  margin-bottom: 1.3rem;
}
.wz-check-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .75rem;
  border-radius: var(--r);
  font-size: 14px;
  margin-bottom: .35rem;
  background: var(--surf2);
  border: 1px solid var(--bord);
}
.wz-check-row.ok   { border-color: rgba(92,184,122,.3);  background: rgba(92,184,122,.06); }
.wz-check-row.fail { border-color: rgba(194,92,92,.3);   background: rgba(194,92,92,.06);  }
.wz-check-row.warn { border-color: rgba(200,155,60,.3);  background: rgba(200,155,60,.06); }
.wz-check-icon { font-size: 16px; flex-shrink: 0; }
.wz-check-icon.ok   { color: var(--suc); }
.wz-check-icon.fail { color: var(--dan); }
.wz-check-icon.warn { color: var(--warn); }
.wz-check-icon.spin { color: var(--mut); animation: wz-spin .8s linear infinite; }
@keyframes wz-spin { to { transform: rotate(360deg); } }
.wz-result-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  padding: .3rem 0;
  color: var(--mut);
}
.wz-result-row.created { color: var(--suc); }
.wz-result-row.error   { color: var(--dan); }
.wz-name-input {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: var(--r);
  padding: .72rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 1.25rem;
}
.wz-name-input:focus { border-color: var(--acc); }

/* ── Blade (side panel overlay) ── */
.blade-backdrop {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.35);
}
.blade {
  position: fixed; top: 0; right: 0;
  width: 440px; height: 100vh;
  background: var(--surf);
  border-left: 1px solid var(--bord);
  box-shadow: -8px 0 32px rgba(0,0,0,.55);
  z-index: 1000; overflow-y: auto; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 0;
  animation: bladeIn .2s ease;
}
@keyframes bladeIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.blade--action { width: 484px; }
.blade-header {
  display: flex; align-items: flex-start; gap: .75rem;
  margin-bottom: 1.2rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--bord);
}
.blade-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--surf2); border: 1px solid var(--bord);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--acc); flex-shrink: 0;
  overflow: hidden;
}
.blade-avatar img { width: 100%; height: 100%; object-fit: cover; }
.blade-name { font-size: 16px; font-weight: 600; color: var(--text); }
.blade-meta { font-size: 13px; color: var(--mut); margin-top: .2rem; line-height: 1.5; }
.blade-section { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--bord); }
.blade-section:last-child { border-bottom: none; }
.blade-footer { margin-top: auto; padding-top: .85rem; }
.blade-close-btn {
  margin-left: auto; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: var(--r);
  background: transparent; border: 1px solid var(--bord);
  color: var(--mut); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.blade-close-btn:hover { border-color: var(--bord2); color: var(--text); }
.blade-score-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem 0; border-bottom: 1px solid var(--bord);
  font-size: 13px;
}
.blade-score-row:last-child { border-bottom: none; }
.history-month { font-size: 12px; font-weight: 600; color: var(--text2); margin: .75rem 0 .3rem; }

/* ── Thread blade ── */
.blade--thread { width: 460px; display: flex; flex-direction: column; }
.thread-msg-list { flex: 1; overflow-y: auto; max-height: 400px; display: flex; flex-direction: column; gap: .75rem; padding-bottom: .25rem; }
.thread-msg { display: flex; }
.thread-msg--slt     { justify-content: flex-start; }
.thread-msg--manager { justify-content: flex-end; }
.thread-bubble { max-width: 88%; background: var(--surf2); border: 1px solid var(--bord); border-radius: 10px; padding: .6rem .75rem; }
.thread-msg--slt     .thread-bubble { border-left: 3px solid var(--acc); }
.thread-msg--manager .thread-bubble { border-right: 3px solid var(--suc); }
.thread-bubble-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .35rem; }
.thread-bubble-text { font-size: 13px; color: var(--text); line-height: 1.55; }
.thread-role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; }
.thread-role-badge--slt     { background: var(--acc); color: var(--bg); }
.thread-role-badge--manager { background: var(--suc);  color: var(--bg); }

/* ── Chat button + orange dot indicator ── */
.rc-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--bord); background: var(--surf2);
  color: var(--mut); font-size: 15px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.rc-btn:hover { border-color: var(--acc); color: var(--acc); }
.rc-btn--active { border-color: var(--warn); color: var(--warn); }
.rc-btn--active:hover { border-color: var(--warn); color: var(--warn); }
.rc-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); border: 2px solid var(--surf);
}
.history-entry { font-size: 12px; color: var(--mut); padding: .25rem 0; border-bottom: 1px solid rgba(42,47,71,.5); }
.history-entry:last-child { border-bottom: none; }

/* ── Active Reviews ── */
.reviews-filters { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.score-filter-btn {
  padding: .3rem .7rem; border-radius: var(--r);
  border: 1px solid var(--bord); background: var(--surf2);
  color: var(--mut); font-size: 12px; cursor: pointer;
}
.score-filter-btn.active { background: var(--acc); border-color: var(--acc); color: var(--bg); font-weight: 600; }
.emp-link { color: var(--acc); text-decoration: none; }
.emp-link:hover { text-decoration: underline; }

/* ── Clickable table row ── */
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover td { background: rgba(74,127,212,.05); }

/* ─── API progress bar ─── */
#page-loading-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, transparent 0%, var(--acc) 30%, var(--acc) 70%, transparent 100%);
  background-size: 200% 100%;
  animation: pgbar 1.2s linear infinite;
  pointer-events: none;
}
@keyframes pgbar {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ─── Skeleton shimmer ─── */
.skel {
  display: inline-block;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bord) 25%, var(--bord2) 50%, var(--bord) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ─── Confirm dialog ─── */
.confirm-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.5);
  animation: fadeIn .15s ease;
}
.confirm-dialog {
  position: fixed; z-index: 1201;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: calc(var(--r) * 2);
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  width: calc(100% - 3rem); max-width: 380px;
  padding: 1.75rem 1.5rem 1.25rem;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  animation: bladeIn .18s ease;
}
.confirm-dialog-icon {
  font-size: 2rem;
  color: var(--dan);
  margin-bottom: .75rem;
  line-height: 1;
}
.confirm-dialog-title {
  font-size: 15px; font-weight: 700;
  color: var(--text1); margin-bottom: .4rem;
}
.confirm-dialog-msg {
  font-size: 13px; color: var(--mut);
  line-height: 1.55; margin-bottom: 1.5rem;
}
.confirm-dialog-footer {
  display: flex; gap: .5rem; width: 100%; justify-content: flex-end;
}
.btn-confirm-ok {
  background: var(--dan);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: .48rem 1.1rem;
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn-confirm-ok:hover  { opacity: .88; }
.btn-confirm-ok:active { transform: scale(.97); }
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Email preview modal ── */
.email-preview-modal {
  position: fixed; z-index: 1201;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surf); border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.45);
  width: min(720px, 92vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: bladeIn .18s ease;
}
.email-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bord);
  background: var(--surf);
  flex-shrink: 0;
  gap: .75rem;
}
.email-preview-title {
  font-size: 1rem; font-weight: 600; color: var(--text1);
  display: flex; align-items: center; gap: .5rem;
}
.email-preview-header .blade-close-btn {
  flex-shrink: 0;
  background: var(--surf2);
  border: 1px solid var(--bord);
  color: var(--text1);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
}
.email-preview-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  background: #f3f4f6;
}
.email-preview-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--bord);
  background: var(--surf);
  flex-shrink: 0;
  gap: .75rem;
}
.email-preview-footer .btn-secondary {
  color: var(--text2);
  border-color: var(--bord2);
}
.email-preview-footer .btn-secondary:hover {
  color: var(--acc);
  border-color: var(--acc);
}
.email-preview-recipient {
  font-size: 12px; color: var(--mut);
  display: flex; align-items: center; gap: .3rem;
}

/* ── AI Summary page ── */
.ai-summary-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ai-summary-header-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.ai-summary-card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  padding: 2.5rem 1.5rem;
}
.ai-summary-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ai-chat-area {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  padding: 1.1rem 1.2rem;
  min-height: 160px;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.ai-messages {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.ai-msg { display: flex; }
.ai-msg--user      { justify-content: flex-end; }
.ai-msg--assistant { justify-content: flex-start; }
.ai-bubble {
  max-width: 85%;
  padding: .65rem .9rem;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text1);
}
.ai-bubble--assistant {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-bottom-left-radius: 3px;
}
.ai-bubble--user {
  background: rgba(74,127,212,.13);
  border: 1px solid rgba(74,127,212,.25);
  border-bottom-right-radius: 3px;
}
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .4rem .2rem;
}
.ai-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mut);
  animation: aiDotBounce 1.2s infinite ease-in-out;
}
.ai-typing-dot:nth-child(2) { animation-delay: .2s; }
.ai-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes aiDotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1);   opacity: 1;   }
}
.ai-input-bar {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: var(--rl);
  padding: .65rem .75rem;
}
.ai-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text1);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  overflow-y: auto;
}
.ai-textarea::placeholder { color: var(--mut); }
.reviews-summarise-btn {
  flex-shrink: 0;
  margin-left: auto;
}

/* Markdown rendering inside assistant bubbles */
.ai-bubble--assistant h2 {
  font-size: .9rem; font-weight: 700; color: var(--text1);
  margin: .85rem 0 .3rem; padding-bottom: .25rem;
  border-bottom: 1px solid var(--bord);
}
.ai-bubble--assistant h3 {
  font-size: .85rem; font-weight: 600; color: var(--text1);
  margin: .7rem 0 .2rem;
}
.ai-bubble--assistant h2:first-child,
.ai-bubble--assistant h3:first-child { margin-top: 0; }
.ai-bubble--assistant p  { margin: 0 0 .3rem; }
.ai-bubble--assistant p:last-child { margin-bottom: 0; }
.ai-bubble--assistant ul,
.ai-bubble--assistant ol { margin: .2rem 0 .35rem 1.25rem; padding: 0; }
.ai-bubble--assistant li { margin-bottom: .2rem; line-height: 1.55; }
.ai-bubble--assistant hr {
  border: none; border-top: 1px solid var(--bord); margin: .6rem 0;
}
.ai-bubble--assistant .ai-spacer { height: .4rem; }
.ai-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; margin: .4rem 0;
  overflow-x: auto; display: block;
}
.ai-table th, .ai-table td {
  padding: 6px 10px;
  border: 1px solid var(--bord);
  text-align: left; vertical-align: top;
  white-space: nowrap;
}
.ai-table th {
  background: var(--surf);
  font-weight: 600; color: var(--text1);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
}
.ai-table tbody tr:hover td { background: rgba(74,127,212,.06); }
