/* ═══════════════════════════════════════════════════════════════
   CATPPUCCIN MOCHA  (dark — default)
   ═══════════════════════════════════════════════════════════════ */
:root, [data-theme="mocha"] {
  --base:      #1e1e2e;
  --mantle:    #181825;
  --crust:     #11111b;
  --surface0:  #313244;
  --surface1:  #45475a;
  --surface2:  #585b70;
  --overlay0:  #6c7086;
  --overlay1:  #7f849c;
  --overlay2:  #9399b2;
  --subtext0:  #a6adc8;
  --subtext1:  #bac2de;
  --text:      #cdd6f4;
  --lavender:  #b4befe;
  --blue:      #89b4fa;
  --sapphire:  #74c7ec;
  --sky:       #89dceb;
  --teal:      #94e2d5;
  --green:     #a6e3a1;
  --yellow:    #f9e2af;
  --peach:     #fab387;
  --maroon:    #eba0ac;
  --red:       #f38ba8;
  --mauve:     #cba6f7;
  --pink:      #f5c2e7;
  --rosewater: #f5e0dc;
  --flamingo:  #f2cdcd;

  /* semantic */
  --bg-app:        var(--base);
  --bg-sidebar:    var(--crust);
  --bg-tabbar:     var(--mantle);
  --bg-card:       var(--mantle);
  --bg-card-hover: var(--surface0);
  --bg-header:     var(--surface0);
  --bg-input:      var(--surface0);
  --bg-modal:      var(--mantle);
  --bg-statusbar:  var(--crust);
  --bg-table-head: var(--surface0);
  --bg-row-hover:  rgba(137,180,250,0.05);

  --text-main:     var(--text);
  --text-muted:    var(--subtext0);
  --text-dim:      var(--overlay0);
  --text-accent:   var(--blue);

  --border:        var(--surface0);
  --border-focus:  var(--blue);

  --tab-active-bg:     var(--base);
  --tab-active-border: var(--blue);
  --tab-inactive:      var(--overlay0);

  --status-up:     var(--green);
  --status-down:   var(--red);
  --status-warn:   var(--yellow);
  --status-unknown:var(--overlay1);

  --status-up-bg:          rgba(166,227,161,0.12);
  --status-down-bg:        rgba(243,139,168,0.12);
  --status-warn-bg:        rgba(249,226,175,0.12);
  --status-up-border:      rgba(166,227,161,0.35);
  --status-down-border:    rgba(243,139,168,0.35);
  --status-warn-border:    rgba(249,226,175,0.35);

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.65);

  --scrollbar-track: var(--mantle);
  --scrollbar-thumb: var(--surface1);
}

/* ═══════════════════════════════════════════════════════════════
   CATPPUCCIN LATTE  (light)
   ═══════════════════════════════════════════════════════════════ */
[data-theme="latte"] {
  --base:      #eff1f5;
  --mantle:    #e6e9ef;
  --crust:     #dce0e8;
  --surface0:  #ccd0da;
  --surface1:  #bcc0cc;
  --surface2:  #acb0be;
  --overlay0:  #9ca0b0;
  --overlay1:  #8c8fa1;
  --overlay2:  #7c7f93;
  --subtext0:  #6c6f85;
  --subtext1:  #5c5f77;
  --text:      #4c4f69;
  --lavender:  #7287fd;
  --blue:      #1e66f5;
  --sapphire:  #209fb5;
  --sky:       #04a5e5;
  --teal:      #179299;
  --green:     #40a02b;
  --yellow:    #df8e1d;
  --peach:     #fe640b;
  --maroon:    #e64553;
  --red:       #d20f39;
  --mauve:     #8839ef;
  --pink:      #ea76cb;
  --rosewater: #dc8a78;
  --flamingo:  #dd7878;

  --bg-app:        var(--base);
  --bg-sidebar:    var(--crust);
  --bg-tabbar:     var(--mantle);
  --bg-card:       #ffffff;
  --bg-card-hover: var(--base);
  --bg-header:     var(--mantle);
  --bg-input:      #ffffff;
  --bg-modal:      #ffffff;
  --bg-statusbar:  var(--crust);
  --bg-table-head: var(--mantle);
  --bg-row-hover:  rgba(30,102,245,0.04);

  --text-main:     var(--text);
  --text-muted:    var(--subtext0);
  --text-dim:      var(--overlay1);
  --text-accent:   var(--blue);

  --border:        var(--surface0);
  --border-focus:  var(--blue);

  --tab-active-bg:     #ffffff;
  --tab-active-border: var(--blue);
  --tab-inactive:      var(--overlay1);

  --status-up:     var(--green);
  --status-down:   var(--red);
  --status-warn:   var(--yellow);
  --status-unknown:var(--overlay1);

  --status-up-bg:          rgba(64,160,43,0.10);
  --status-down-bg:        rgba(210,15,57,0.08);
  --status-warn-bg:        rgba(223,142,29,0.10);
  --status-up-border:      rgba(64,160,43,0.30);
  --status-down-border:    rgba(210,15,57,0.25);
  --status-warn-border:    rgba(223,142,29,0.30);

  --shadow-sm: 0 1px 4px rgba(76,79,105,0.12);
  --shadow-md: 0 4px 14px rgba(76,79,105,0.16);
  --shadow-lg: 0 12px 40px rgba(76,79,105,0.22);

  --scrollbar-track: var(--mantle);
  --scrollbar-thumb: var(--surface1);
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  background: var(--bg-app);
  color: var(--text-main);
  transition: background 0.25s ease, color 0.25s ease;
  line-height: 1.5;
}

a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface2); }

/* ═══════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════ */
#shell {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: 40px 1fr 22px;
  grid-template-areas:
    "sidebar tabbar"
    "sidebar main"
    "sidebar statusbar";
  height: 100vh;
  overflow: hidden;
}

/* ── TAB BAR ─────────────────────────────────────────────────── */
#tabbar {
  grid-area: tabbar;
  background: var(--bg-tabbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--tab-inactive);
  border-right: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  user-select: none;
  position: relative;
}
.tab:hover { color: var(--text-main); background: var(--bg-app); }
.tab.active {
  background: var(--tab-active-bg);
  color: var(--text-main);
  border-bottom: 2px solid var(--tab-active-border);
}
.tab-icon { font-size: 11px; opacity: 0.7; }
.tab-close {
  font-size: 10px; opacity: 0; margin-left: 4px; padding: 2px 4px;
  border-radius: 3px; transition: opacity 0.15s, background 0.15s;
  cursor: pointer; color: var(--text-muted);
}
.tab:hover .tab-close { opacity: 1; }
.tab-close:hover { background: var(--surface0); color: var(--red); }

.tabbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-left: 1px solid var(--border);
}

#last-update { font-size: 11px; color: var(--text-dim); }

#theme-toggle {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface0); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px; cursor: pointer;
  font-size: 11px; color: var(--text-muted); font-family: inherit;
  transition: all 0.15s;
}
#theme-toggle:hover { background: var(--surface1); color: var(--text-main); }
.toggle-sun { color: var(--yellow); }
.toggle-moon { color: var(--lavender); }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
#sidebar {
  grid-area: sidebar;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
  z-index: 10;
}

.sidebar-logo {
  font-size: 15px; font-weight: 700; color: var(--blue);
  margin-bottom: 12px; letter-spacing: -1px;
  text-align: center; line-height: 1;
  width: 100%; padding: 4px 0;
}

.sb-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s;
  color: var(--overlay1); position: relative; border: none; background: none;
}
.sb-btn:hover { background: var(--surface0); color: var(--text-main); }
.sb-btn.active { background: rgba(137,180,250,0.15); color: var(--blue); }
.sb-btn::after {
  content: attr(data-tip);
  position: absolute; left: 48px; top: 50%; transform: translateY(-50%);
  background: var(--surface1); color: var(--text-main);
  font-size: 11px; padding: 4px 8px; border-radius: 4px;
  white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.15s; z-index: 100;
  border: 1px solid var(--border); font-family: 'JetBrains Mono', monospace;
}
.sb-btn:hover::after { opacity: 1; }

.sb-spacer { flex: 1; }

#btn-create-app-sb {
  width: 36px; height: 36px; background: var(--blue); color: var(--base);
  border-radius: 8px; display: none; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; font-weight: 300; border: none;
  transition: all 0.15s; margin-top: 8px;
}
#btn-create-app-sb:hover { background: var(--lavender); }

/* ── MAIN AREA ───────────────────────────────────────────────── */
#main {
  grid-area: main;
  overflow-y: auto;
  background: var(--bg-app);
}

.content-area {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 28px;
}

/* ── STATUS BAR ──────────────────────────────────────────────── */
#statusbar {
  grid-area: statusbar;
  background: var(--bg-statusbar);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.sb-item {
  display: flex; align-items: center; gap: 5px;
  padding: 0 10px; height: 100%;
  font-size: 11px; color: var(--text-dim);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.sb-item.accent { color: var(--blue); }
.sb-item.ok-dot::before { content: '●'; color: var(--green); margin-right: 4px; font-size: 8px; }
.sb-item.err-dot::before { content: '●'; color: var(--red); margin-right: 4px; font-size: 8px; }
.sb-spacer-right { margin-left: auto; }
#sb-theme-name { color: var(--mauve); }

/* ═══════════════════════════════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════════════════════════════ */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-dim);
  margin-bottom: 20px;
}
.breadcrumb .bc-sep { color: var(--overlay0); }
.breadcrumb .bc-active { color: var(--text-muted); }
.breadcrumb .bc-link { color: var(--blue); cursor: pointer; }
.breadcrumb .bc-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════
   INCIDENT BANNER
   ═══════════════════════════════════════════════════════════════ */
#incidents-banner { margin-bottom: 20px; }

.incident-card {
  background: var(--status-down-bg);
  border: 1px solid var(--status-down-border);
  border-left: 3px solid var(--status-down);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.incident-card .inc-label {
  font-size: 11px; font-weight: 500; color: var(--red);
  letter-spacing: 0.5px; text-transform: uppercase;
}
.incident-card .inc-name { font-size: 13px; color: var(--text-main); margin-top: 2px; }
.incident-card .inc-time { font-size: 11px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════════════════════
   SECTION HEADER
   ═══════════════════════════════════════════════════════════════ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before { content: '//'; color: var(--overlay0); font-size: 11px; }
.section-count {
  background: var(--surface0); color: var(--text-dim);
  font-size: 10px; padding: 1px 7px; border-radius: 10px;
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   APP CARDS GRID
   ═══════════════════════════════════════════════════════════════ */
#apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--status-up);
  border-radius: 10px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.app-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(137,180,250,0.15), transparent);
  opacity: 0; transition: opacity 0.18s;
}
.app-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--surface1);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.app-card:hover::before { opacity: 1; }
.app-card.incident { border-left-color: var(--status-down); background: var(--status-down-bg); }
.app-card.incident:hover { border-color: var(--status-down-border); }
.app-card.degraded { border-left-color: var(--status-warn); background: var(--status-warn-bg); }
.app-card.degraded:hover { border-color: var(--status-warn-border); }
.app-card.unknown { border-left-color: var(--status-unknown); }

.app-card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px; margin-bottom: 12px;
}
.app-card-info { flex: 1; min-width: 0; }
.app-name {
  font-size: 14px; font-weight: 500; color: var(--text-main);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-desc { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.app-card-meta {
  font-size: 11px; color: var(--text-dim);
  padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between;
}
.app-card-actions {
  display: flex; gap: 6px; margin-top: 12px; opacity: 0; transition: opacity 0.15s;
}
.app-card:hover .app-card-actions { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.4px;
  text-transform: uppercase; padding: 3px 9px; border-radius: 4px;
  border: 1px solid; white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}
.badge::before { font-size: 8px; }

.badge.healthy  { background: var(--status-up-bg);   color: var(--status-up);   border-color: var(--status-up-border);   }
.badge.healthy::before { content: '●'; }
.badge.incident { background: var(--status-down-bg); color: var(--status-down); border-color: var(--status-down-border); }
.badge.incident::before { content: '✕'; }
.badge.degraded { background: var(--status-warn-bg); color: var(--status-warn); border-color: var(--status-warn-border); }
.badge.degraded::before { content: '▲'; }
.badge.unknown  { background: var(--surface0); color: var(--text-dim); border-color: var(--border); }
.badge.unknown::before { content: '?'; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s; border: 1px solid; white-space: nowrap;
}
.btn-primary {
  background: var(--blue); color: var(--base); border-color: var(--blue);
}
.btn-primary:hover { background: var(--lavender); border-color: var(--lavender); }

.btn-secondary {
  background: var(--surface0); color: var(--text-muted); border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface1); color: var(--text-main); }

.btn-danger {
  background: var(--status-down-bg); color: var(--red); border-color: var(--status-down-border);
}
.btn-danger:hover { background: rgba(243,139,168,0.22); border-color: var(--red); }

.btn-ghost {
  background: transparent; color: var(--text-dim); border-color: transparent;
  padding: 5px 10px; font-size: 11px;
}
.btn-ghost:hover { background: var(--surface0); color: var(--text-main); border-color: var(--border); }

/* ═══════════════════════════════════════════════════════════════
   DETAIL VIEW
   ═══════════════════════════════════════════════════════════════ */
#detail-view { display: none; }

.detail-header-actions {
  display: flex; gap: 10px; margin-bottom: 20px; align-items: center;
}

.detail-header-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 22px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.detail-header-card h2 {
  font-size: 22px; font-weight: 700; color: var(--text-main); margin-bottom: 6px;
}
.detail-header-card p { font-size: 13px; color: var(--text-muted); }
.detail-urls {
  margin-top: 14px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 12px;
}
.detail-urls a { color: var(--sapphire); }
.detail-urls a:hover { color: var(--sky); }

/* uptime cards */
.uptime-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.uptime-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 12px; text-align: center;
}
.uptime-card .period {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 8px;
}
.uptime-card .percent {
  font-size: 26px; font-weight: 700; color: var(--status-up);
}
.uptime-card .percent.warn   { color: var(--status-warn); }
.uptime-card .percent.danger { color: var(--status-down); }

.detail-section-title {
  font-size: 11px; font-weight: 500; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1px;
  margin: 24px 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.detail-section-title::before { content: '//'; color: var(--overlay0); }

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */
.table-wrap { border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }

thead th {
  background: var(--bg-table-head);
  padding: 10px 14px; text-align: left;
  font-size: 10px; font-weight: 500; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 11px 14px; color: var(--text-main);
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--bg-row-hover); }

.table-actions { display: flex; gap: 6px; opacity: 0; transition: opacity 0.12s; }
tr:hover .table-actions { opacity: 1; }

td .code {
  font-size: 11px; color: var(--sapphire);
  background: var(--surface0); padding: 2px 6px; border-radius: 4px;
}
td .latency { color: var(--peach); }
td .ts { color: var(--text-dim); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-dim); font-size: 13px;
  border: 1px dashed var(--border); border-radius: 10px;
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-title { color: var(--text-muted); font-size: 14px; margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(6px);
  animation: fadeInModal 0.18s ease;
}
@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 90%; max-width: 560px; max-height: 92vh;
  overflow-y: auto;
  animation: slideUpModal 0.22s ease;
}
.modal-small { max-width: 400px; }

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

#modal-confirm-delete .modal-content {
  border-top: 3px solid var(--red);  
}

#modal-confirm-delete .modal-header h2::before {
  content: '[WARN]';              
  color: var(--red);
  font-size: 10px;
  margin-right: 8px;
  letter-spacing: 0.5px;
}



.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  background: var(--bg-table-head); border-radius: 12px 12px 0 0;
  border-bottom: 1px solid var(--blue);
  border-left: 3px solid var(--blue);
}
.modal-header h2 {
  font-size: 14px; font-weight: 500; color: var(--text-main);
  display: flex; align-items: center; gap: 8px;
}
.modal-header h2::before { content: '>_'; color: var(--blue); font-size: 12px; margin-right: 6px}

.modal-close {
  /* Remplacer le caractère emoji par un symbole CSS propre */
  content: "×";  
  font-size: 20px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.modal-close:hover { background: var(--status-down-bg); color: var(--red); }

/* ── FORMS ───────────────────────────────────────────────────── */
form { padding: 20px 22px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-family: 'JetBrains Mono', monospace;
  background: var(--bg-input); color: var(--text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.form-group input::placeholder,
.form-group select::placeholder { color: var(--text-dim); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(137,180,250,0.15);
}
.form-group select { cursor: pointer; }
.form-group textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.form-group label input[type="checkbox"] {
  display: inline; width: auto; margin-right: 8px;
  cursor: pointer; accent-color: var(--blue);
}
.form-group label.required::after {
  content: ' *';
  color: var(--red);
  font-size: 10px;
}

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}

#confirm-message {
  padding: 16px 22px; font-size: 13px; color: var(--text-muted); line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   DEBUG PANEL
   ═══════════════════════════════════════════════════════════════ */
#debug-panel {
  background: var(--crust); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; margin-bottom: 20px;
  font-size: 11px; max-height: 220px; overflow-y: auto;
}
#debug-panel h3 { color: var(--blue); margin-bottom: 8px; font-size: 12px; }
#debug-panel p { margin: 3px 0; color: var(--text-dim); }
#debug-panel .debug-error { color: var(--red); }
#debug-panel .debug-success { color: var(--green); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #shell {
    grid-template-columns: 1fr;
    grid-template-rows: 40px 1fr 22px;
    grid-template-areas: "tabbar" "main" "statusbar";
  }
  #sidebar { display: none; }
  .content-area { padding: 16px; }
  #apps-grid { grid-template-columns: 1fr; }
  .uptime-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-content {
    /* Ombre plus prononcée pour faire "flotter" au-dessus */
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    /* Bordure plus subtile */
    border: 1px solid var(--surface1);
    /* Légère translation vers le haut à l'ouverture */
    transform: translateY(-10px);
    transition: transform 0.3s ease;
    width: 95%;
  }
  .modal.open .modal-content {
    transform: translateY(0);
  }
  form { padding: 16px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions button { width: 100%; }
}

@media (max-width: 480px) {
  .tab span.tab-label { display: none; }
  .tabbar-right { padding: 0 8px; }
  #last-update { display: none; }
}
/* ═══════════════════════════════════════════════════════════════
   RESULT DRAWER
   ═══════════════════════════════════════════════════════════════ */

#result-drawer {
  position: fixed;
  top: 0; right: -480px;
  width: 460px;
  height: 100vh;
  background: var(--bg-modal);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#result-drawer.open { right: 0; }

#result-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 899;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
#result-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#app-front-url {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7086' stroke-width='2'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 32px;
}


.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-header);
}

.drawer-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
  letter-spacing: 0.5px;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.drawer-close:hover {
  color: var(--text-main);
  background: var(--surface0);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Bloc statut principal */
.drawer-status-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface0);
  border: 1px solid var(--border);
}

.drawer-status-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.drawer-status-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-status-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Section de détail */
.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-section-title {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.drawer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 12px;
}
.drawer-row:last-child { border-bottom: none; }

.drawer-row-key {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 110px;
}

.drawer-row-val {
  font-size: 11px;
  color: var(--text-main);
  text-align: right;
  word-break: break-word;
  font-family: 'JetBrains Mono', monospace;
}

/* Badge fingerprint */
.fp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}
.fp-ok          { background: var(--status-up-bg);   color: var(--green);   border: 1px solid var(--status-up-border); }
.fp-loading     { background: var(--status-warn-bg);  color: var(--yellow);  border: 1px solid var(--status-warn-border); }
.fp-down        { background: var(--status-down-bg);  color: var(--red);     border: 1px solid var(--status-down-border); }
.fp-unknown     { background: var(--surface0);        color: var(--overlay1);border: 1px solid var(--border); }
.fp-ping_failed { background: var(--status-down-bg);  color: var(--maroon);  border: 1px solid var(--status-down-border); }

/* Message d'erreur formaté */
.drawer-error-box {
  background: var(--surface0);
  border: 1px solid var(--status-down-border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--red);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.6;
  word-break: break-word;
}

/* Ligne cliquable dans table historique */
.history-row-clickable {
  cursor: pointer;
  transition: background 0.15s;
}
.history-row-clickable:hover { background: var(--bg-row-hover); }

/* ── LOGIN SCREEN ─────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--base);
  display: none;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 40px 36px;
  background: var(--mantle);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
}

.login-logo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--mauve);
  margin-bottom: 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.login-error {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  color: var(--red);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  display: none;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.login-error.shake { animation: shake .35s ease; }

/* ── LOGOUT BTN ───────────────────────────────────────────── */
#btn-logout {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
#btn-logout:hover {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  background: color-mix(in srgb, var(--red) 8%, transparent);
}