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

/* ============================================================
   DESIGN TOKENS — Corporate Blue Light Theme
   ============================================================ */
:root {
  /* Sidebar */
  --sidebar-bg:        #1E3A5F;
  --sidebar-border:    rgba(255,255,255,0.08);
  --sidebar-text:      #CBD5E1;
  --sidebar-text-active: #FFFFFF;
  --sidebar-active-bg: rgba(37,99,235,0.35);
  --sidebar-hover-bg:  rgba(255,255,255,0.07);

  /* Backgrounds */
  --bg-base:           #F1F5F9;
  --bg-surface:        #FFFFFF;
  --bg-surface-2:      #F8FAFC;
  --bg-card:           #FFFFFF;
  --bg-card-hover:     #F8FAFC;

  /* Borders */
  --border:            #E2E8F0;
  --border-hover:      #CBD5E1;
  --border-focus:      #2563EB;

  /* Primary — Corporate Blue */
  --primary:           #2563EB;
  --primary-dark:      #1D4ED8;
  --primary-light:     #EFF6FF;
  --primary-dim:       rgba(37,99,235,0.12);

  /* Semantic colours */
  --success:           #16A34A;
  --success-light:     #F0FDF4;
  --warning:           #D97706;
  --warning-light:     #FFFBEB;
  --danger:            #DC2626;
  --danger-light:      #FEF2F2;
  --purple:            #7C3AED;
  --purple-light:      #F5F3FF;
  --cyan:              #0891B2;
  --cyan-light:        #ECFEFF;

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

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:  0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg:  0 10px 30px rgba(15,23,42,0.10);
  --shadow-xl:  0 20px 50px rgba(15,23,42,0.14);

  --transition: all 0.18s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EFF6FF 0%, #F1F5F9 50%, #E0F2FE 100%);
}
.login-bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.login-bg-orb.one { width:500px;height:500px;background:rgba(37,99,235,0.10);top:-100px;left:-120px; }
.login-bg-orb.two { width:350px;height:350px;background:rgba(14,165,233,0.08);bottom:0;right:-80px; }

.login-card {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 420px;
  box-shadow: var(--shadow-xl);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), #1D4ED8);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.login-logo-text { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.login-logo-text small { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); }

.login-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.login-sub   { font-size: 13px; color: var(--text-secondary); margin-bottom: 28px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.login-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}
.login-input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-dim); }
.login-input::placeholder { color: var(--text-muted); }
.login-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 14px; font-weight: 600;
  border: none; border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  margin-top: 4px;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37,99,235,0.4); }
.login-btn:active { transform: translateY(0); }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #1D4ED8);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(37,99,235,0.4);
  flex-shrink: 0;
}
.sidebar-logo-text { font-size: 14px; font-weight: 700; color: #FFFFFF; line-height: 1.2; }
.sidebar-logo-text small { font-size: 10px; font-weight: 400; color: #94A3B8; letter-spacing: 0.3px; }

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 13px; font-weight: 500;
  transition: var(--transition);
}
.nav-item:hover { background: var(--sidebar-hover-bg); color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #0891B2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: #94A3B8; }
.btn-logout {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: #94A3B8; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); text-decoration: none;
}
.btn-logout:hover { background: rgba(220,38,38,0.2); border-color: rgba(220,38,38,0.4); color: #FCA5A5; }

/* ============================================================
   MAIN AREA
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.live-badge {
  display: flex; align-items: center; gap: 7px;
  background: var(--success-light);
  border: 1px solid rgba(22,163,74,0.25);
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px; font-weight: 500; color: var(--success);
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 28px 0;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #A855F7); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--primary), #60A5FA); }
.stat-card.cyan::before   { background: linear-gradient(90deg, var(--cyan), #22D3EE); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #4ADE80); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-card.purple .stat-icon { background: var(--purple-light); }
.stat-card.blue   .stat-icon { background: var(--primary-light); }
.stat-card.cyan   .stat-icon { background: var(--cyan-light); }
.stat-card.green  .stat-icon { background: var(--success-light); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header { padding: 24px 28px 12px; }
.section-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.section-sub   { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

/* ============================================================
   FILTER PANEL
   ============================================================ */
.filter-panel {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  padding: 16px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-select, .filter-input {
  padding: 9px 12px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition);
  min-width: 140px;
}
.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  background: #fff;
}

.btn-filter {
  padding: 9px 20px;
  background: var(--primary);
  color: #fff; font-size: 13px; font-weight: 600;
  border: none; border-radius: var(--radius-md);
  transition: var(--transition);
  white-space: nowrap;
}
.btn-filter:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.btn-reset {
  padding: 9px 20px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.btn-reset:hover { border-color: var(--border-hover); color: var(--text-primary); background: #fff; }

/* ============================================================
   RESULTS BAR
   ============================================================ */
.results-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 28px;
  background: var(--primary-light);
  border-bottom: 1px solid rgba(37,99,235,0.15);
  font-size: 13px;
}
.results-count { color: var(--text-secondary); }
.results-count strong { color: var(--primary); font-weight: 700; }
.results-meta  { color: var(--text-muted); font-size: 12px; }

/* ============================================================
   THUMBNAIL GRID
   ============================================================ */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px 28px;
  flex: 1;
}
.thumb-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.thumb-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.thumb-card.idle-card { border-color: rgba(217,119,6,0.3); }
.thumb-img-wrap { position: relative; height: 148px; background: #F1F5F9; overflow: hidden; }
.thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.thumb-card:hover .thumb-img { transform: scale(1.04); }

/* Timestamp badge overlaid on image */
.thumb-time {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(15,23,42,0.72);
  color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
/* Star button on thumbnails */
.star-btn {
  position: absolute; top: 6px; left: 6px;
  background: rgba(15,23,42,0.55);
  border: none; border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 15px; line-height: 28px; text-align: center;
  color: #fff; cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform 0.2s, background 0.2s;
  z-index: 3;
  padding: 0;
}
.star-btn:hover           { transform: scale(1.2); background: rgba(234,179,8,0.85); }
.star-btn.starred         { background: rgba(234,179,8,0.9); color: #fff; }
.starred-card             { border-color: #EAB308 !important; box-shadow: 0 0 0 2px rgba(234,179,8,0.25), var(--shadow-md); }

/* Nav starred count badge */
.starred-count-badge {
  display: inline-block;
  margin-left: auto;
  background: #EAB308; color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
  min-width: 20px; text-align: center;
}

.idle-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--warning); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
}
/* Hover overlay with zoom icon */
.thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(37,99,235,0.12);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
}
.thumb-card:hover .thumb-overlay { opacity: 1; }
.thumb-zoom-icon { font-size: 24px; }

/* Card info below image */
.thumb-info { padding: 10px 12px; border-top: 1px solid var(--border); }
.thumb-user { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   USER GRID
   ============================================================ */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 28px 28px;
}
.user-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.user-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.user-card-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.user-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), #0891B2);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.user-pc   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.user-dept {
  display: inline-block; margin-top: 5px;
  background: var(--primary-light); color: var(--primary);
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; letter-spacing: 0.3px;
}
.status-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 99px;
}
.status-badge.active   { background: var(--success-light); color: var(--success); }
.status-badge.inactive { background: #F1F5F9; color: var(--text-muted); }

.user-stats { display: flex; gap: 0; border-top: 1px solid var(--border); margin: 0 -20px; padding: 12px 20px 0; }
.user-stat { flex: 1; text-align: center; }
.user-stat + .user-stat { border-left: 1px solid var(--border); }
.user-stat-val { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.user-stat-lbl { font-size: 10px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

.btn-manage {
  width: 100%; margin-top: 14px;
  padding: 9px; background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 12px; font-weight: 600;
  transition: var(--transition);
}
.btn-manage:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ============================================================
   DAILY SUMMARY VIEW
   ============================================================ */
.summary-table-wrap {
  padding: 0 28px 28px;
  overflow-x: auto;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.summary-table th {
  background: var(--bg-surface-2);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.summary-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.summary-table tr:last-child td { border-bottom: none; }
.summary-table tr:hover td { background: var(--bg-surface-2); }

.metric-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.metric-pill.office  { background: var(--primary-light);  color: var(--primary); }
.metric-pill.active  { background: var(--success-light);  color: var(--success); }
.metric-pill.idle          { background: var(--warning-light);  color: var(--warning); }
.metric-pill.productive    { background: var(--success-light);  color: var(--success); }
.metric-pill.communication { background: var(--primary-light);  color: var(--primary); }
.metric-pill.unproductive  { background: var(--danger-light);   color: var(--danger);  }

/* Category badges on thumbnail cards */
.cat-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
}
.cat-productive    { background: var(--success-light);  color: var(--success); }
.cat-communication { background: var(--primary-light);  color: var(--primary); }
.cat-unproductive  { background: var(--danger-light);   color: var(--danger);  }
.cat-idle          { background: var(--warning-light);  color: var(--warning); }

.time-bar-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.time-bar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.time-bar-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.time-bar-fill.active { background: var(--success); }
.time-bar-fill.idle   { background: var(--warning); }

/* ============================================================
   ANALYTICS VIEW
   ============================================================ */
.chart-card {
  margin: 0 28px 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chart-title  { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.chart-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.legend-dot   { width: 10px; height: 10px; border-radius: 50%; }
.chart-wrap   { height: 280px; position: relative; }

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 0 28px 28px;
}
.breakdown-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.breakdown-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; }
.breakdown-bar  { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.breakdown-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #60A5FA); border-radius: 99px; transition: width 0.8s ease; }
.breakdown-meta { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #CBD5E1; border-radius: 99px;
  transition: var(--transition); cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 13px; color: var(--text-secondary); }

/* ============================================================
   FORM ROWS
   ============================================================ */
.form-row { display: flex; flex-direction: column; gap: 6px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  animation: backdropIn 0.2s ease;
}
.modal-backdrop.open { display: flex; }
@keyframes backdropIn { from { opacity:0; } to { opacity:1; } }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 480px;
  max-width: 94vw;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.22s ease both;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.95) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.modal-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: monospace; }
.modal-body  { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.modal-footer-right { display: flex; gap: 10px; }

.btn-close {
  width: 32px; height: 32px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-close:hover { background: var(--danger-light); border-color: rgba(220,38,38,0.3); color: var(--danger); }

.btn-danger {
  padding: 9px 18px;
  background: var(--danger-light);
  border: 1px solid rgba(220,38,38,0.25);
  border-radius: var(--radius-md);
  color: var(--danger); font-size: 13px; font-weight: 600;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox-backdrop.open { display: flex; }

.lightbox {
  position: relative;
  width: 96vw;
  max-width: 1600px;
  height: 95vh;
  display: flex;
  flex-direction: column;
  background: #1E293B;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: lightboxIn 0.22s ease both;
}
@keyframes lightboxIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }

.lightbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  background: #1E293B;
}
.lightbox-title { font-size: 14px; font-weight: 600; color: #F1F5F9; }
.lightbox-meta  { font-size: 12px; color: #94A3B8; margin-top: 2px; }

.lightbox-img-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #0F172A;
  position: relative;
  min-height: 0;
}
.lightbox-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.lightbox-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--primary);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lightbox-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 12px;
  background: #1E293B;
}
.lightbox-counter { font-size: 13px; color: #94A3B8; white-space: nowrap; }
.lightbox-counter strong { color: #F1F5F9; }
.lightbox-nav    { display: flex; align-items: center; gap: 8px; }
.lightbox-actions { display: flex; align-items: center; gap: 8px; }

.btn-nav {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: #E2E8F0; font-size: 13px; font-weight: 500;
  transition: var(--transition);
}
.btn-nav:hover:not(:disabled) { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.2); }
.btn-nav:disabled { opacity: 0.35; cursor: default; }
.btn-download { background: rgba(37,99,235,0.2); border-color: rgba(37,99,235,0.4); color: #93C5FD; }
.btn-download:hover { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.btn-star-lb { background: rgba(234,179,8,0.15); border-color: rgba(234,179,8,0.4); color: #EAB308; }
.btn-star-lb:hover, .lb-star-active { background: rgba(234,179,8,0.85) !important; border-color: #EAB308 !important; color: #fff !important; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  animation: toastIn 0.3s ease both;
  min-width: 260px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--primary); }
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* ============================================================
   VIEWS
   ============================================================ */
.view { flex: 1; display: flex; flex-direction: column; }

/* ============================================================
   DELETE PANEL (danger zone)
   ============================================================ */
.danger-zone {
  margin: 0 28px 28px;
  background: var(--danger-light);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -240px; transition: left 0.3s ease; }
  .main { margin-left: 0; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filter-panel { flex-direction: column; padding: 14px 16px; }
  .thumb-grid { padding: 12px 16px; }
  .lightbox { width: 98vw; height: 98vh; max-width: 98vw; border-radius: 8px; }
}
