/* Creatis PRO — lisible, logo top-left, fond sobre */
:root {
  --bg: #0c0e14;
  --bg-elev: #141821;
  --bg-card: #1a1f2b;
  --bg-card-2: #202636;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f6fa;
  --text-dim: #b6bcc9;
  --text-mute: #8b93a7;
  --orange: #FF7B1C;
  --orange-dim: rgba(255, 123, 28, 0.18);
  --blue: #0A84FF;
  --radius: 10px;
  --radius-sm: 8px;
  --header-h: 60px;
  --sidebar-w: 200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  background-image:
    radial-gradient(900px 420px at 0% 0%, rgba(255, 123, 28, 0.07), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(10, 132, 255, 0.06), transparent 50%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.tiny { font-size: 12px; color: var(--text-mute); }
.error { color: #ff6b6b; font-size: 13px; margin-top: 10px; }

/* Brand */
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-row--lg { margin-bottom: 22px; gap: 12px; }
.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 7px;
}
.brand-row--lg .brand-logo { width: 44px; height: 44px; border-radius: 9px; }
.brand-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--orange);
  border-radius: 5px;
  vertical-align: middle;
}
.brand-row h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 6px;
  font-weight: 560;
}
.field-input,
.liquid-input,
.liquid-select,
.liquid-textarea,
.field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #0f131c;
  color: var(--text);
  outline: none;
  margin-bottom: 12px;
}
.field-input::placeholder,
.liquid-input::placeholder { color: var(--text-mute); }
.field-input:focus,
.liquid-input:focus,
.liquid-select:focus,
.liquid-textarea:focus {
  border-color: rgba(255, 123, 28, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 123, 28, 0.18);
}
.liquid-textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-card-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 560;
  transition: background .15s var(--ease), border-color .15s;
}
.btn:hover { background: #272e40; }
.btn-primary {
  width: 100%;
  background: var(--orange);
  border-color: #ff8d3a;
  color: #fff;
  font-weight: 650;
  margin-top: 4px;
}
.btn-primary:hover { background: #ff8a2e; }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.btn-sm { padding: 7px 10px; font-size: 12px; width: auto; }

/* Aliases used by admin.js */
.btn-liquid { composes: btn; }
.btn-liquid,
.btn-liquid.btn-liquid--primary,
.btn-liquid.btn-liquid--ghost,
.btn-liquid.btn-liquid--sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-card-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 560;
}
.btn-liquid--primary {
  background: var(--orange) !important;
  border-color: #ff8d3a !important;
  color: #fff !important;
  font-weight: 650;
}
.btn-liquid--ghost { background: transparent !important; color: var(--text-dim) !important; }
.btn-liquid--sm { padding: 7px 10px !important; font-size: 12px !important; width: auto !important; }

/* App shell */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: rgba(14, 17, 24, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.app-body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 14px 10px;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-btn {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 540;
}
.nav-btn:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-btn.active {
  background: var(--orange-dim);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--orange);
}

.main {
  min-width: 0;
  padding: 18px 20px 32px;
}
.page-head { margin-bottom: 16px; }
.page-head h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.page-head .muted { margin-top: 4px; font-size: 13px; }
.content { display: flex; flex-direction: column; gap: 14px; }

.period-seg,
.liquid-segment {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: #0f131c;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.period-seg button,
.liquid-segment button {
  border: 0;
  background: transparent;
  color: var(--text-mute);
  padding: 7px 11px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 560;
}
.period-seg button.active,
.liquid-segment button.active {
  background: var(--bg-card-2);
  color: var(--text);
}

/* Cards / KPIs — opaques pour lisibilité */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.kpi,
.card,
.liquid-panel,
.ticket {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.kpi { padding: 14px 16px; }
.kpi .label {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 6px;
  font-weight: 550;
}
.kpi .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.kpi .hint { font-size: 11px; color: var(--text-mute); margin-top: 4px; }

.card,
.liquid-panel { padding: 16px; }
.card h3,
.liquid-panel > h3 {
  font-size: 14px;
  margin-bottom: 12px;
  font-weight: 650;
  color: var(--text);
}

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.chart-box { position: relative; height: 260px; cursor: crosshair; }
.chart-box.sm { height: 200px; cursor: crosshair; }

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  max-height: 520px;
  background: #12161f;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  color: var(--text);
}
th {
  color: var(--text-dim);
  font-weight: 620;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  background: #171c27;
  z-index: 1;
}
th:hover { color: var(--text); }
th .sort { opacity: 0.5; margin-left: 4px; }
td small { color: var(--text-mute); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.tag-free { background: rgba(255,255,255,0.08); color: var(--text-dim); }
.tag-pro { background: rgba(255,123,28,0.2); color: #ffb36a; border-color: rgba(255,123,28,0.35); }
.tag-studio { background: rgba(10,132,255,0.2); color: #7ec8ff; border-color: rgba(10,132,255,0.35); }
.tag-open { background: rgba(52,199,89,0.18); color: #7dff9a; }
.tag-closed { background: rgba(255,255,255,0.06); color: var(--text-mute); }
.tag-src { background: rgba(255,255,255,0.07); color: var(--text-dim); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .liquid-input { margin: 0; max-width: 280px; }
.toolbar .liquid-select { margin: 0; width: auto; min-width: 140px; }

.map-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; }
.map-row {
  display: grid;
  grid-template-columns: 48px 1fr 40px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text);
}
.map-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.map-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  border-radius: 4px;
}

.meter {
  height: 10px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin-top: 8px;
}
.meter > i { display: block; height: 100%; background: var(--orange); border-radius: 5px; }
.meter.warn > i { background: #ffd60a; }
.meter.danger > i { background: #ff453a; }

.ticket { padding: 14px; margin-bottom: 10px; }
.ticket-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.msg { font-size: 13px; margin-top: 6px; color: var(--text-dim); }
.msg b { color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.switch {
  width: 42px;
  height: 24px;
  border-radius: 6px;
  background: #0f131c;
  border: 1px solid var(--line-strong);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.switch.on { background: rgba(255,123,28,0.4); border-color: rgba(255,123,28,0.65); }
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 4px;
  background: #fff;
  transition: transform .18s var(--ease);
}
.switch.on::after { transform: translateX(18px); }

.intel-bar {
  height: 10px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin-top: 6px;
}
.intel-bar > i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #FF7B1C, #0A84FF);
}
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.score-pill {
  background: #12161f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.score-pill .n {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.score-pill .l {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.on { background: #34c759; box-shadow: 0 0 8px rgba(52,199,89,0.6); }
.status-dot.off { background: #ff453a; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.chip.good { background: rgba(52,199,89,0.12); color: #7dff9a; border-color: rgba(52,199,89,0.25); }
.chip.bad { background: rgba(255,69,58,0.12); color: #ff8f8f; border-color: rgba(255,69,58,0.25); }


@media (max-width: 980px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .app-header { height: auto; padding: 12px 14px; flex-wrap: wrap; }
}
