@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

.ms {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  display: inline-block;
  line-height: 1;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
}

*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:var(--color-background);color:var(--color-on-surface);font-size:14px;overflow-x:hidden}

:root,
[data-theme="light"],
html.light {
  --primary:#2383e2;
  --primary-light:rgba(35,131,226,0.12);
  --success:#10b981;
  --success-light:rgba(16,185,129,0.12);
  --warning:#f59e0b;
  --warning-light:rgba(245,158,11,0.12);
  --danger:#ef4444;
  --danger-light:rgba(239,68,68,0.12);
  --info:#2383e2;
  --info-light:rgba(35,131,226,0.12);
  --border:rgba(0,0,0,0.08);
  --muted:#64748b;
  --text-sec:#64748b;
  --color-surface:#ffffff;
  --color-surface-container:#f8fafc;
  --color-surface-container-low:#ffffff;
  --color-surface-container-high:#f1f5f9;
  --color-surface-container-highest:#e2e8f0;
  --color-outline-variant:rgba(0,0,0,0.08);
  --color-on-surface:#0f172a;
  --color-on-surface-variant:#64748b;
  --color-background:#f8fafc;
  --sk-shimmer-rgb:0,0,0;
}

[data-theme="dark"],
html.dark {
  --primary:#2383e2;
  --primary-light:rgba(35,131,226,0.15);
  --success:#4ade80;
  --success-light:rgba(74,222,128,0.1);
  --warning:#fac05e;
  --warning-light:rgba(250,192,94,0.1);
  --danger:#f87171;
  --danger-light:rgba(248,113,113,0.1);
  --info:#2383e2;
  --info-light:rgba(35,131,226,0.1);
  --border:rgba(255,255,255,0.08);
  --muted:#9ca3af;
  --text-sec:#9ca3af;
  --color-surface:#191919;
  --color-surface-container:#202020;
  --color-surface-container-low:#1c1c1c;
  --color-surface-container-high:#262626;
  --color-surface-container-highest:#2e2e2e;
  --color-outline-variant:rgba(255,255,255,0.08);
  --color-on-surface:#e6e6e6;
  --color-on-surface-variant:#9ca3af;
  --color-background:#141414;
  --sk-shimmer-rgb:255,255,255;
}

::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--color-outline-variant);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--color-on-surface-variant)}

.inp{width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--color-outline-variant);font-size:13px;outline:none;font-family:inherit;background:var(--color-surface-container);color:var(--color-on-surface);transition:border-color .15s, background-color .2s, color .2s}
.inp:focus{border-color:var(--primary)}
textarea.inp{resize:vertical}
.lbl{display:block;font-size:11px;font-weight:600;color:var(--color-on-surface-variant);margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}
.btn{padding:6px 12px;border-radius:6px;cursor:pointer;font-weight:500;font-size:13px;font-family:inherit;border:1px solid transparent;transition:opacity .15s, background-color .2s, color .2s;display:inline-flex;align-items:center;gap:5px}
.btn:hover{opacity:.85}
.btn-primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.btn-secondary{background:var(--color-surface-container-high);color:var(--color-on-surface);border-color:var(--color-outline-variant)}
.btn-danger{background:var(--color-surface);color:#ef4444;border-color:#fca5a5}
.btn-danger-fill{background:#ef4444;color:#fff}
.btn-success{background:var(--success);color:#fff}
.btn-warning{background:var(--warning);color:#fff}
.btn-sm{padding:3px 9px;font-size:12px}
.btn-xs{padding:2px 6px;font-size:11px}
.card{background:var(--color-surface-container);border:1px solid var(--border);border-radius:10px;padding:18px;margin-bottom:12px;color:var(--color-on-surface);transition:background-color .25s, border-color .25s}
table{width:100%;border-collapse:collapse;font-size:13px;border:none}
th{padding:9px 12px;text-align:left;font-weight:700;font-size:11px;color:var(--color-on-surface-variant);text-transform:uppercase;letter-spacing:.5px;border-bottom:1px solid var(--border);cursor:pointer;user-select:none;white-space:nowrap}
th:hover{color:var(--primary)}
td{padding:10px 12px;border-bottom:1px solid var(--border);vertical-align:middle;color:var(--color-on-surface)}
tr:hover td{cursor:pointer}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.grid3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px}
@media(max-width:768px){.grid2,.grid3{grid-template-columns:1fr}.modal-box{padding:16px}.modal-overlay{padding:8px}}
.lcard{border:1px solid var(--border);border-radius:8px;padding:11px 13px;background:var(--color-surface);color:var(--color-on-surface);display:flex;align-items:center;gap:10px;cursor:pointer;transition:border-color .15s, background-color .2s;margin-bottom:8px}
.lcard:hover{border-color:var(--primary)}
.empty{text-align:center;padding:24px;border:1px dashed var(--color-outline-variant);border-radius:8px;color:var(--color-on-surface-variant);font-size:13px;margin-bottom:8px}
.sec-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.sec-title span{font-weight:700;font-size:13px;color:var(--color-on-surface)}
.tag{display:inline-flex;align-items:center;gap:3px;padding:2px 9px;border-radius:20px;font-size:11px;font-weight:700}
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:1000;padding:16px;overflow-y:auto;backdrop-filter:blur(4px)}
.modal-box{background:var(--color-surface);color:var(--color-on-surface);border-radius:12px;padding:24px;width:100%;max-width:600px;box-shadow:0 20px 60px rgba(0,0,0,.25);max-height:90vh;overflow-y:auto;border:1px solid var(--border);transition:background-color .25s, border-color .25s}
.modal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}
.modal-title{font-weight:800;font-size:16px;color:var(--color-on-surface)}
.modal-footer{display:flex;justify-content:flex-end;gap:8px;margin-top:20px;padding-top:16px;border-top:1px solid var(--border)}
/* Connection bar */
.conn-bar{display:flex;align-items:center;gap:10px;padding:8px 16px;border-radius:8px;font-size:12px;margin-bottom:12px;border:1px solid var(--border);background:var(--color-surface-container)}
.conn-bar.connected{background:var(--success-light);border-color:#86efac;color:#15803d}
.conn-bar.disconnected{background:var(--warning-light);border-color:#fcd34d;color:#92400e}
.save-indicator{opacity:0;transition:opacity .3s;font-size:11px;color:var(--color-on-surface-variant);padding:2px 8px;background:var(--color-surface-container-high);border-radius:12px}
.save-indicator.visible{opacity:1}
/* Welcome screen */
.welcome-screen{display:none;position:fixed;inset:0;background:var(--color-background);z-index:500;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:40px;text-align:center;color:var(--color-on-surface)}
.welcome-screen.visible{display:flex}
/* Detail / dp-card */
.dp-card{background:var(--color-surface-container);border:1px solid var(--border);border-radius:10px;margin-bottom:12px;overflow:hidden;color:var(--color-on-surface)}
.dp-card-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:var(--color-surface-container-high);border-bottom:1px solid var(--border);font-weight:700;font-size:13px;color:var(--color-on-surface)}
.dp-card-body{padding:14px 16px}
.prop-grid{display:flex;flex-direction:column}
.prop-row{display:flex;gap:10px;padding:7px 0;border-bottom:1px solid var(--border);align-items:flex-start}
.prop-row:last-child{border-bottom:none}
.prop-key{width:140px;flex-shrink:0;font-weight:600;color:var(--color-on-surface-variant);font-size:11px;text-transform:uppercase;letter-spacing:.4px;padding-top:2px}
.prop-val{font-size:13px;flex:1;color:var(--color-on-surface)}
.rel-card{display:flex;align-items:center;gap:10px;padding:10px 14px;cursor:pointer;transition:background .15s;border-bottom:1px solid var(--border)}
.rel-card:last-child{border-bottom:none}
.rel-card:hover{background:var(--color-surface-container-high)}
.rel-icon{font-size:20px;flex-shrink:0;color:var(--primary)}
.rel-name{font-weight:600;font-size:13px;color:var(--color-on-surface)}
.rel-sub{font-size:11px;color:var(--color-on-surface-variant);margin-top:2px}
/* Media */
.media-thumb-grid{display:flex;flex-wrap:wrap;gap:8px}
.media-thumb-wrap{position:relative;display:inline-block}
.media-thumb{width:90px;height:72px;border:1px solid var(--border);border-radius:8px;overflow:hidden;cursor:pointer;background:var(--color-surface-container);display:flex;align-items:center;justify-content:center}
.media-thumb:hover{border-color:var(--primary)}
.media-thumb-actions{position:absolute;top:2px;right:2px;display:flex;flex-direction:column;gap:2px}
.media-thumb-del,.media-thumb-share{background:var(--color-surface);color:var(--color-on-surface);border:1px solid var(--border);border-radius:4px;width:20px;height:20px;font-size:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 3px rgba(0,0,0,0.1);transition:all .15s}
.media-thumb-del:hover{background:var(--danger);color:#fff;border-color:var(--danger)}
.media-thumb-share:hover{background:var(--primary);color:#fff;border-color:var(--primary)}
.media-thumb-share.active{background:var(--success);color:#fff;border-color:var(--success)}
.media-thumb-tag:hover{background:var(--primary);color:#fff;border-color:var(--primary)}
.media-thumb-tag{background:var(--color-surface);color:var(--color-on-surface);border:1px solid var(--border);border-radius:4px;width:20px;height:20px;font-size:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 3px rgba(0,0,0,0.1);transition:all .15s}
.media-tag-badge{position:absolute;bottom:4px;left:4px;right:4px;background:rgba(0,0,0,0.7);color:#fff;font-size:9px;padding:2px 5px;border-radius:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;font-weight:700;text-transform:uppercase}
.media-thumb-placeholder,.media-thumb-icon{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:22px;gap:2px;color:var(--color-on-surface-variant)}
.media-thumb-label{font-size:9px;font-weight:700;color:var(--color-on-surface-variant)}
.upload-zone{border:2px dashed var(--color-outline-variant);border-radius:8px;padding:20px;text-align:center;color:var(--color-on-surface-variant);cursor:pointer;font-size:13px;transition:all .15s}
.upload-zone:hover,.upload-zone.drag-active{border-color:var(--primary);color:var(--primary)}
.upload-zone.drag-active{background:var(--primary-light);transform:scale(1.02);border-style:solid}
/* Viewer */
.viewer-modal-layer{position:fixed;inset:0;background:rgba(0,0,0,.85);z-index:2000;display:flex;align-items:center;justify-content:center;padding:16px}
.viewer-container{background:var(--color-surface);border-radius:12px;max-width:900px;width:100%;max-height:92vh;display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--border)}
.viewer-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border);color:var(--color-on-surface)}
.viewer-title{font-weight:600;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.viewer-body{overflow:auto;display:flex;align-items:center;justify-content:center;padding:16px;flex:1;min-height:200px}
/* Pagination */
.pg-bar{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:var(--color-surface-container);border-top:1px solid var(--border);font-size:12px;flex-wrap:wrap;gap:8px;color:var(--color-on-surface)}
.pg-btn{padding:4px 10px;border:1px solid var(--border);background:var(--color-surface-container-high);color:var(--color-on-surface);border-radius:5px;cursor:pointer;font-size:12px;transition:all .15s}
.pg-btn:hover:not(:disabled){background:var(--color-surface-container-highest)}
.pg-btn.active{background:var(--primary);color:#fff;border-color:var(--primary)}
.pg-btn:disabled{opacity:.4;cursor:not-allowed}
/* Alert */
.alert{padding:10px 14px;border-radius:8px;display:flex;gap:8px;align-items:flex-start;font-size:13px;margin-bottom:12px;line-height:1.5}
.alert-warning{background:var(--warning-light);border:1px solid #fcd34d;color:#92400e}
.alert-info{background:var(--info-light);border:1px solid #93c5fd;color:#1e40af}
.alert-danger{background:var(--danger-light);border:1px solid #fca5a5;color:#991b1b}
.alert-success{background:var(--success-light);border:1px solid #6ee7b7;color:#065f46}
/* Timeline */
.timeline{position:relative;padding-left:24px}
.timeline::before{content:'';position:absolute;left:7px;top:0;bottom:0;width:2px;background:var(--border)}
.tl-item{position:relative;padding-bottom:16px}
.tl-item::before{content:'';position:absolute;left:-19px;top:4px;width:10px;height:10px;border-radius:50%;background:var(--primary);border:2px solid var(--color-surface)}
.tl-date{font-size:11px;color:var(--color-on-surface-variant);margin-bottom:3px}
.tl-content{background:var(--color-surface-container);border:1px solid var(--border);border-radius:6px;padding:8px 12px;font-size:13px;color:var(--color-on-surface)}
/* Tab navigation */
.tab-btn{padding:8px 14px;background:none;border:none;cursor:pointer;font-size:13px;font-family:inherit;display:flex;align-items:center;gap:4px;white-space:nowrap;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .15s;color:var(--color-on-surface-variant);font-weight:500}
.tab-btn.active{color:var(--primary);border-bottom-color:var(--primary);font-weight:700}
.tab-btn:hover{color:var(--primary)}
/* Count badge in tab */
.tab-count{background:var(--color-surface-container-highest);color:var(--color-on-surface-variant);border-radius:20px;padding:0 6px;font-size:10px;font-weight:700}
.tab-btn.active .tab-count{background:var(--primary-light);color:var(--primary)}
/* Header app */
.app-header{background:var(--color-surface-container);border-bottom:1px solid var(--border);padding:12px 20px;position:sticky;top:0;z-index:100;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;color:var(--color-on-surface)}
.logo-block{display:flex;align-items:center;gap:10px}
.logo-icon{width:36px;height:36px;background:linear-gradient(135deg,#4f46e5,#7c3aed);border-radius:8px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:800;font-size:13px}
.logo-name{font-size:16px;font-weight:800;color:var(--color-on-surface)}
.logo-sub{font-size:11px;color:var(--color-on-surface-variant)}
.stat-chip{padding:8px 14px;border-radius:8px;border:1px solid var(--border);background:var(--color-surface);text-align:center;min-width:80px;color:var(--color-on-surface)}
.stat-chip .chip-val{font-size:18px;font-weight:800}
.stat-chip .chip-lbl{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--color-on-surface-variant)}
.stat-chip.green{border-color:var(--success);background:var(--success-light);color:#065f46}
.stat-chip.yellow{border-color:var(--warning);background:var(--warning-light);color:#92400e}
.stat-chip.blue{border-color:var(--info);background:var(--info-light);color:#1e40af}
.stat-chip.purple{border-color:#7c3aed;background:#ede9fe;color:#5b21b6}
.stat-chip.red{border-color:var(--danger);background:var(--danger-light);color:#991b1b}
/* Login */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--color-background);padding:20px}
.login-box{background:var(--color-surface);border:1px solid var(--border);border-radius:12px;padding:36px;width:100%;max-width:380px;box-shadow:0 10px 40px rgba(0,0,0,.15);color:var(--color-on-surface)}
/* Search box */
.search-wrap{position:relative;flex:1;min-width:160px}
.search-wrap input{padding-left:32px}
.search-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--color-on-surface-variant);font-size:13px;pointer-events:none}
/* ss-wrap quick add */
.ss-qa-row{display:flex;align-items:flex-start;gap:6px}
.ss-qa-btn{flex-shrink:0;width:34px;height:34px;display:flex;align-items:center;justify-content:center;background:var(--primary-light);color:var(--primary);border:1px solid var(--primary);border-radius:6px;cursor:pointer;font-size:16px;font-weight:700;margin-top:1px}
.ss-qa-btn:hover{background:var(--primary);color:#fff}
/* Progress Bar & Dynamic Loading — Premium Look */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-background);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), backdrop-filter 0.5s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.progress-container {
  width: 320px;
  height: 10px;
  background: var(--color-surface-container-high);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #4f46e5);
  background-size: 200% 100%;
  animation: shimmer 2s infinite linear;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.3);
}

@keyframes shimmer {
  0% { background-position: 100% 0%; }
  100% { background-position: -100% 0%; }
}

.loading-step {
  font-size: 12px;
  color: var(--color-on-surface-variant);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 8px;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.loading-logo {
  animation: float 4s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Sticky Group Accordion Header */
.sticky-group-header {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--color-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.sticky-group-header:hover {
  background: var(--color-surface-container-high);
}

/* Batch Bar */
.batch-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-container);
  color: var(--color-on-surface);
  padding: 8px 16px;
  border-radius: 99px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid var(--border);
}
.batch-count {
  font-weight: 700;
  color: var(--primary);
}
.btn-light {
  background: var(--color-surface-container-high);
  color: var(--color-on-surface);
  border: 1px solid var(--border);
}
.btn-light:hover {
  background: var(--color-surface-container-highest);
}

/* Custom styles for Searchable Select (sSelect) */
.ss-wrap {
  position: relative;
  width: 100%;
}
.ss-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--primary);
  font-size: 11px;
  transition: transform 0.2s ease;
  user-select: none;
}
.ss-drop {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: none;
}
.ss-drop::-webkit-scrollbar {
  display: block;
  width: 6px;
}
.ss-drop::-webkit-scrollbar-track {
  background: transparent;
}
.ss-drop::-webkit-scrollbar-thumb {
  background: var(--color-outline-variant);
  border-radius: 3px;
}
.ss-opt {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--color-on-surface);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ss-opt:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.ss-opt.sel {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.ss-empty {
  color: var(--color-on-surface-variant);
  font-style: italic;
  text-align: center;
  padding: 12px;
}

/* Border Radius Tokens */
.rounded-3xl { border-radius: 14px !important; }
.rounded-2xl { border-radius: 10px !important; }
.rounded-xl { border-radius: 8px !important; }
.rounded-lg { border-radius: 6px !important; }
.rounded-md { border-radius: 5px !important; }

/* SKELETON SCREENS & SHIMMER EFFECT */
@keyframes sk-shimmer-wave {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.sk-bone {
  position: relative !important;
  overflow: hidden !important;
  background-color: var(--color-surface-container-high) !important;
  border-radius: 6px;
  display: block;
}

.sk-bone::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(var(--sk-shimmer-rgb), 0.05) 25%,
    rgba(var(--sk-shimmer-rgb), 0.22) 50%,
    rgba(var(--sk-shimmer-rgb), 0.05) 75%,
    transparent 100%
  );
  animation: sk-shimmer-wave 2.3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

.sk-bone-dark {
  position: relative !important;
  overflow: hidden !important;
  background-color: var(--color-surface-container-low) !important;
  border-radius: 6px;
  display: block;
}

.sk-bone-dark::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(var(--sk-shimmer-rgb), 0.05) 25%,
    rgba(var(--sk-shimmer-rgb), 0.18) 50%,
    rgba(var(--sk-shimmer-rgb), 0.05) 75%,
    transparent 100%
  );
  animation: sk-shimmer-wave 2.3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

.sk-fade-in {
  animation: skFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes skFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Top Progress Line */
#top-loading-line {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 99999;
  background: linear-gradient(90deg, #2383e2, #60a5fa, #3b82f6);
  box-shadow: 0 0 10px rgba(35, 131, 226, 0.7);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
  pointer-events: none;
}

/* STATS TIMELINE BAR */
.stats-timeline-wrap {
  background: var(--color-surface-container);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-family: inherit;
  color: var(--color-on-surface);
}
.stats-timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface-container-high);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  gap: 12px;
}
.stats-timeline-devtools-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.stats-timeline-filter-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  height: 26px;
  font-size: 11px;
  color: var(--color-on-surface);
}
.stats-timeline-chips {
  display: flex;
  align-items: center;
  gap: 3px;
}
.stats-timeline-chip {
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-on-surface-variant);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.stats-timeline-chip:hover {
  background: var(--color-surface-container-highest);
  color: var(--color-on-surface);
}
.stats-timeline-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}
.stats-timeline-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stats-timeline-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--color-surface);
  color: var(--color-on-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 14px;
}
.stats-timeline-nav-btn:hover {
  background: var(--color-surface-container-high);
}
.stats-timeline-month-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-on-surface);
  min-width: 120px;
  text-align: center;
  letter-spacing: -0.01em;
}
.stats-timeline-period-sel {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}
.stats-timeline-period-btn {
  padding: 2px 8px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}
.stats-timeline-period-btn.active {
  background: var(--primary);
  color: #ffffff;
}
.stats-timeline-period-btn:hover:not(.active) {
  color: var(--color-on-surface);
}
.stats-timeline-canvas-wrap {
  position: relative;
  height: 110px;
  background: var(--color-surface);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}
.stats-timeline-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.stats-timeline-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: var(--color-surface-container-high);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--color-on-surface-variant);
}
.stats-timeline-status-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stats-timeline-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stats-timeline-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-on-surface-variant);
}
.stats-timeline-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.stats-timeline-range-tag {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* CLICKABLE HARDWARE BADGES */
.stats-hw-badge {
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.stats-hw-badge:hover {
  transform: scale(1.08);
}
.stats-hw-badge .stats-hw-badge-icon {
  font-size: 12px;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s ease;
}
.stats-hw-badge:hover .stats-hw-badge-icon {
  opacity: 1;
  transform: translateX(0);
}

/* HARDWARE DETAIL DRAWER */
.stats-hw-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  justify-content: flex-end;
}
.stats-hw-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.3s;
}
.stats-hw-drawer-panel {
  position: relative;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  overflow-y: auto;
  background: var(--color-surface);
  color: var(--color-on-surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0,0,0,0.25);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease;
}
.stats-hw-drawer-panel.open {
  transform: translateX(0);
}
.stats-hw-drawer-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 20px;
  transition: background-color 0.25s ease;
}
.stats-hw-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--color-surface-container-high);
  color: var(--color-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.stats-hw-drawer-close:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  color: #f87171;
}
.stats-hw-drawer-body {
  padding: 16px 20px 24px;
}

/* Day Group Headers */
.stats-hw-day-group {
  margin-bottom: 16px;
}
.stats-hw-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--color-surface-container-high);
  border: 1px solid var(--border);
}
.stats-hw-day-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stats-hw-day-count {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--color-surface-container-highest);
  color: var(--color-on-surface-variant);
}

/* Intervention cards in drawer */
.stats-hw-item {
  background: var(--color-surface-container);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.stats-hw-item:hover {
  background: var(--color-surface-container-high);
  border-color: var(--primary);
}
.stats-hw-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-on-surface-variant);
  margin-top: 4px;
}
.stats-hw-item-row:first-child {
  margin-top: 0;
}
.stats-hw-item-label {
  font-weight: 600;
  color: var(--color-on-surface-variant);
  min-width: 70px;
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stats-hw-item-value {
  font-weight: 700;
  color: var(--color-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-hw-item-value.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--primary);
  font-size: 10px;
}

/* Empty State */
.stats-hw-drawer-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-on-surface-variant);
}
.stats-hw-drawer-empty .ms {
  font-size: 48px;
  color: var(--color-outline-variant);
  display: block;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * Legacy inline utility adapters for theme reactivity
 * ═══════════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .bg-\[\#131313\],
html.light .bg-\[\#131313\],
[data-theme="light"] .bg-\[\#191919\],
html.light .bg-\[\#191919\] {
  background-color: var(--color-surface-container-high) !important;
}

[data-theme="light"] .bg-\[\#1c1b1b\],
html.light .bg-\[\#1c1b1b\],
[data-theme="light"] .bg-\[\#202020\],
html.light .bg-\[\#202020\] {
  background-color: var(--color-surface-container) !important;
}

[data-theme="light"] .border-\[\#353534\],
html.light .border-\[\#353534\],
[data-theme="light"] .border-white\/10,
html.light .border-white\/10,
[data-theme="light"] .border-white\/15,
html.light .border-white\/15 {
  border-color: var(--color-outline-variant) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * NOTION-STYLE TOAST NOTIFICATION SYSTEM (Minimalist, subtle, non-blocking)
 * ═══════════════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 2.5rem);
}

.toast-item {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: auto;
  max-width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  font-family: var(--notion-font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.8125rem;
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: -0.01em;
  background: var(--notion-surface, #202020);
  color: var(--notion-text, #e6e6e6);
  border: 1px solid var(--notion-border, rgba(255, 255, 255, 0.08));
  box-shadow: 0 6px 20px -2px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.25s ease,
              padding 0.25s ease;
  transform: translateY(-8px) scale(0.97);
  opacity: 0;
  overflow: hidden;
  will-change: transform, opacity;
  box-sizing: border-box;
}

[data-theme="light"] .toast-item,
html.light .toast-item {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 6px 20px -2px rgba(15, 15, 15, 0.1), 0 1px 4px rgba(15, 15, 15, 0.05);
}

.toast-item.toast-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast-item.toast-leaving {
  transform: translateY(-6px) scale(0.96);
  opacity: 0;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: -0.5rem !important;
  pointer-events: none;
}

/* Notion Status Badges & Colors */
/* SUCCÈS (Vert Notion) */
.toast-item.toast-success .toast-icon-wrap {
  background: rgba(77, 171, 154, 0.18);
  color: #52c41a;
}
[data-theme="light"] .toast-item.toast-success .toast-icon-wrap,
html.light .toast-item.toast-success .toast-icon-wrap {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}
.toast-item.toast-success .toast-progress-fill {
  background: #52c41a;
}
[data-theme="light"] .toast-item.toast-success .toast-progress-fill,
html.light .toast-item.toast-success .toast-progress-fill {
  background: #15803d;
}

/* ERREUR (Rouge Notion) */
.toast-item.toast-error .toast-icon-wrap {
  background: rgba(255, 115, 105, 0.18);
  color: #ff7b72;
}
[data-theme="light"] .toast-item.toast-error .toast-icon-wrap,
html.light .toast-item.toast-error .toast-icon-wrap {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}
.toast-item.toast-error .toast-progress-fill {
  background: #ff7b72;
}
[data-theme="light"] .toast-item.toast-error .toast-progress-fill,
html.light .toast-item.toast-error .toast-progress-fill {
  background: #b91c1c;
}

/* INFO (Bleu Notion) */
.toast-item.toast-info .toast-icon-wrap {
  background: rgba(82, 156, 202, 0.18);
  color: #58a6ff;
}
[data-theme="light"] .toast-item.toast-info .toast-icon-wrap,
html.light .toast-item.toast-info .toast-icon-wrap {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
}
.toast-item.toast-info .toast-progress-fill {
  background: #58a6ff;
}
[data-theme="light"] .toast-item.toast-info .toast-progress-fill,
html.light .toast-item.toast-info .toast-progress-fill {
  background: #0369a1;
}

/* AVERTISSEMENT (Orange Notion) */
.toast-item.toast-warning .toast-icon-wrap {
  background: rgba(255, 138, 76, 0.18);
  color: #ff9b57;
}
[data-theme="light"] .toast-item.toast-warning .toast-icon-wrap,
html.light .toast-item.toast-warning .toast-icon-wrap {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
}
.toast-item.toast-warning .toast-progress-fill {
  background: #ff9b57;
}
[data-theme="light"] .toast-item.toast-warning .toast-progress-fill,
html.light .toast-item.toast-warning .toast-progress-fill {
  background: #c2410c;
}

/* Internal elements */
.toast-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  transition: transform 0.2s ease;
}

.toast-icon-svg {
  width: 15px;
  height: 15px;
}

.toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding-right: 0.125rem;
}

.toast-message {
  display: inline-block;
  vertical-align: middle;
  word-break: break-word;
}

.toast-close-btn {
  background: transparent;
  border: none;
  padding: 3px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  color: var(--notion-text-muted, #9b9a97);
  transition: opacity 0.15s, background-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.toast-close-btn:hover {
  opacity: 1;
  color: var(--notion-text, #e6e6e6);
  background-color: rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .toast-close-btn {
  color: #64748b;
}
[data-theme="light"] .toast-close-btn:hover {
  color: #0f172a;
  background-color: rgba(0, 0, 0, 0.06);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
[data-theme="light"] .toast-progress {
  background: rgba(0, 0, 0, 0.04);
}

.toast-progress-fill {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: toast-progress linear forwards;
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

