/* ============================================================================
   Maretha Ops — warm "espresso & gold" control console
   Brown canvas (#6b3f22), espresso panels, cream text, Maretha-gold accent.
   JetBrains Mono for telemetry, Archivo for prose.
   ========================================================================== */
:root {
  --bg:        #6b3f22;   /* requested brown canvas */
  --bg-1:      #2f1c0e;   /* inset / inputs         */
  --panel:     #3a2212;
  --panel-2:   #432815;
  --raised:    #4e3320;
  --line:      rgba(255, 228, 190, 0.12);
  --line-2:    rgba(255, 228, 190, 0.20);

  --txt:       #f6ecdd;
  --txt-dim:   #d6c0a2;
  --muted:     #a98c6b;

  --gold:      #e8bf50;   /* logo gold — brand + interactive */
  --gold-2:    #f3d27a;
  --ok:        #5fd98a;
  --warn:      #ff9f3d;
  --err:       #ff6f61;
  --idle:      #a98c6b;

  --ok-bg:   rgba(95, 217, 138, 0.13);
  --warn-bg: rgba(255, 159, 61, 0.14);
  --err-bg:  rgba(255, 111, 97, 0.14);
  --idle-bg: rgba(200, 170, 130, 0.10);
  --gold-bg: rgba(232, 191, 80, 0.15);

  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: "Archivo", system-ui, sans-serif;

  --r:   14px;
  --r-s: 9px;
  --shadow: 0 18px 50px -22px rgba(0,0,0,0.75);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- atmosphere layers ---------------------------------------------------- */
.fx-grid, .fx-glow, .fx-scan { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.fx-grid {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% -10%, #000 35%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% -10%, #000 35%, transparent 78%);
  opacity: 0.45;
}
.fx-glow {
  background:
    radial-gradient(60% 50% at 12% -8%, rgba(232,191,80,0.13), transparent 60%),
    radial-gradient(55% 45% at 92% 4%, rgba(255,200,120,0.08), transparent 60%);
}
.fx-scan {
  background: linear-gradient(180deg, transparent, rgba(232,191,80,0.05) 50%, transparent);
  height: 180px; top: -180px;
  animation: scan 9s linear infinite;
}
@keyframes scan { to { transform: translateY(calc(100vh + 360px)); } }
body::after { /* grain */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app, #login { position: relative; z-index: 1; }

/* ---- utility -------------------------------------------------------------- */
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }

/* ---- login ---------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 92vw); padding: 44px 38px; text-align: center;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--ok), transparent);
}
.login-logo { width: 68px; height: 68px; display: block; margin: 0 auto 20px; filter: drop-shadow(0 6px 18px rgba(232,191,80,0.30)); }
.login-mark, .brand-mark {
  font-family: var(--mono); font-weight: 800; letter-spacing: 3px; font-size: 22px; color: var(--txt);
}
.login-mark span, .brand-mark span { color: var(--gold); }
.login-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--txt-dim); margin: 10px 0 30px; }
.login-foot { margin-top: 22px; font-family: var(--mono); font-size: 10px; letter-spacing: 2px; color: var(--muted); }

/* ---- buttons -------------------------------------------------------------- */
.btn {
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.6px;
  padding: 10px 16px; border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: var(--raised); color: var(--txt); cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 11px; }
.btn-primary { background: linear-gradient(180deg, #f0cb63, #e0b342); border-color: rgba(232,191,80,0.6); color: #3a2212; font-weight: 700; }
.btn-primary:hover { box-shadow: 0 0 0 3px var(--gold-bg), 0 8px 20px -8px rgba(232,191,80,0.5); }
.btn-warn  { color: var(--warn); border-color: rgba(255,159,61,0.4); }
.btn-warn:hover  { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.btn-danger{ color: var(--err); border-color: rgba(255,111,97,0.4); }
.btn-danger:hover{ border-color: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--raised); }

/* ---- topbar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(45,26,13,0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-logo { width: 30px; height: 30px; display: block; }
.brand-mark { font-size: 17px; letter-spacing: 2.5px; }
.env {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--ok); padding: 4px 9px; border: 1px solid rgba(95,217,138,0.35); border-radius: 6px; background: var(--ok-bg);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--txt-dim); letter-spacing: 1px; }
.who { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---- health strip --------------------------------------------------------- */
.health {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  padding: 22px 26px 6px;
}
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 2px solid var(--idle);
  border-radius: var(--r); padding: 14px 16px 13px; min-width: 0;
  box-shadow: var(--shadow); animation: rise .5s both;
}
.stat--ok   { border-left-color: var(--ok); }
.stat--warn { border-left-color: var(--warn); }
.stat--err  { border-left-color: var(--err); }
.stat--gold { border-left-color: var(--gold); }
.stat--idle { border-left-color: var(--idle); }
.stat-k { font-family: var(--mono); font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--txt-dim); }
.stat-v {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--txt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-sub { margin-top: 5px; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .dot { flex: none; }
.stat--ok .dot   { background: var(--ok);  box-shadow: 0 0 0 3px var(--ok-bg); }
.stat--warn .dot { background: var(--warn);box-shadow: 0 0 0 3px var(--warn-bg); animation: pulse 1.3s infinite; }
.stat--err .dot  { background: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.stat--gold .dot { background: var(--gold);box-shadow: 0 0 0 3px var(--gold-bg); }
.stat--idle .dot { background: var(--idle); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- main grid ------------------------------------------------------------ */
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: min-content; gap: 14px; padding: 14px 26px 40px;
}
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 16px;
  min-width: 0; box-shadow: var(--shadow); animation: rise .55s both;
}
.stat:nth-child(1){animation-delay:.02s}.stat:nth-child(2){animation-delay:.06s}.stat:nth-child(3){animation-delay:.10s}.stat:nth-child(4){animation-delay:.14s}.stat:nth-child(5){animation-delay:.18s}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.area-deploy   { grid-column: 1; animation-delay:.06s; }
.area-activity { grid-column: 2 / 4; grid-row: 1 / 3; animation-delay:.12s; }
.area-uploaded { grid-column: 1; animation-delay:.18s; }
.area-installed{ grid-column: 1 / 4; animation-delay:.24s; }

.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-h h2 { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase; color: var(--txt); }
.card-h h2::before { content: "▍"; color: var(--gold); margin-right: 7px; }
.card-note { font-size: 12px; color: var(--txt-dim); margin: -6px 0 14px; line-height: 1.5; }
.count-chip { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---- pills ---------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--idle); }
.pill--ok   { color: var(--ok);   background: var(--ok-bg);   border-color: rgba(95,217,138,0.3); } .pill--ok i   { background: var(--ok); }
.pill--warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(255,159,61,0.3); } .pill--warn i { background: var(--warn); animation: pulse 1.3s infinite; }
.pill--err  { color: var(--err);  background: var(--err-bg);  border-color: rgba(255,111,97,0.3); }  .pill--err i  { background: var(--err); }
.pill--idle { color: var(--txt-dim); background: var(--idle-bg); }
.pill--gold { color: var(--gold); background: var(--gold-bg); border-color: rgba(232,191,80,0.3); } .pill--gold i { background: var(--gold); }

/* chips */
.chip { display:inline-flex; align-items:center; font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 7px; background: var(--raised); border: 1px solid var(--line); color: var(--txt-dim); margin: 0 6px 6px 0; }
.chip--ok { color: var(--ok); border-color: rgba(95,217,138,0.3); }
.chip--err{ color: var(--err);border-color: rgba(255,111,97,0.3); }

/* ---- deploy card ---------------------------------------------------------- */
.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-s); padding: 20px 16px; text-align: center;
  transition: border-color .15s, background .15s; background: rgba(232,191,80,0.03);
}
.dropzone.drag { border-color: var(--gold); background: var(--gold-bg); }
.dropzone p { margin: 0 0 10px; font-size: 13px; color: var(--txt-dim); }
.dropzone code { font-family: var(--mono); color: var(--gold); background: var(--gold-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.dropzone input[type=file] { font-family: var(--mono); font-size: 11px; color: var(--muted); max-width: 100%; }
.progress { height: 5px; background: var(--raised); border-radius: 99px; margin-top: 12px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--ok)); transition: width .2s; }
.field { display: block; margin: 4px 0 14px; }
.field span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--txt-dim); margin-bottom: 7px; }
select, .search {
  width: 100%; font-family: var(--mono); font-size: 13px; color: var(--txt);
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 10px 12px;
}
select:focus, .search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---- activity card -------------------------------------------------------- */
.tabs { display: flex; gap: 4px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-s); padding: 4px; margin-bottom: 14px; }
.tab {
  flex: 1; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.8px;
  padding: 7px 8px; border-radius: 6px; border: 0; background: transparent; color: var(--txt-dim); cursor: pointer; transition: .15s;
}
.tab.on { background: var(--raised); color: var(--txt); box-shadow: inset 0 0 0 1px var(--line-2); }
.tab:hover:not(.on) { color: var(--txt); }
.act-pane { min-height: 320px; }
.pad { padding: 28px 8px; text-align: center; }

/* live steps */
.loghdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; font-family: var(--mono); font-size: 12px; }
.step + .step { margin-top: 3px; }
.step-ic { width: 16px; text-align: center; font-weight: 700; flex: none; }
.step-nm { color: var(--txt-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step--ok .step-ic { color: var(--ok); }
.step--err  { background: var(--err-bg); } .step--err .step-ic { color: var(--err); } .step--err .step-nm { color: var(--txt); }
.step--warn { background: var(--warn-bg); } .step--warn .step-ic { color: var(--warn); } .step--warn .step-nm { color: var(--txt); }
.step--idle .step-ic { color: var(--muted); }

/* runs + audit lists */
.runs, .audit { list-style: none; margin: 0; padding: 0; }
.runs li, .audit li { border-top: 1px solid var(--line); }
.runs li:first-child, .audit li:first-child { border-top: 0; }
.run { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; align-items: center; padding: 11px 4px; }
.run-t { font-size: 13px; color: var(--txt); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-m { grid-column: 2; font-size: 11px; }
.audit li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 4px; }
.aud-a { font-family: var(--mono); font-size: 12px; color: var(--txt); }
.aud-d { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-m { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 11px; text-align: right; }

/* ---- uploaded + installed lists ------------------------------------------ */
.addons { list-style: none; margin: 0; padding: 0; }
.addons li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.addons li:first-child { border-top: 0; }
.addons .nm { font-family: var(--mono); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm { font-family: var(--mono); font-size: 11px; color: var(--err); background: transparent; border: 1px solid rgba(255,111,97,0.3); border-radius: 6px; padding: 4px 9px; cursor: pointer; flex: none; }
.rm:hover { background: var(--err-bg); }

.ins-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ins-bar .search { flex: 1; }
.kvlist { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 0 22px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.kv-k { font-size: 12.5px; color: var(--txt-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-v { font-size: 11px; color: var(--muted); flex: none; }
.kvlist::-webkit-scrollbar { width: 8px; }
.kvlist::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }

/* ---- toast ---------------------------------------------------------------- */
.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 30; font-family: var(--mono); font-size: 12px; padding: 11px 18px; border-radius: 10px;
  background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow); color: var(--txt);
}
.toast.ok  { border-color: rgba(95,217,138,0.5); }
.toast.err { border-color: rgba(255,111,97,0.5); color: #ffe0db; }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 1080px) {
  .health { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .area-deploy, .area-activity, .area-uploaded, .area-installed { grid-column: 1; grid-row: auto; }
}
@media (max-width: 560px) {
  .health { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
  .health, .grid { padding-left: 16px; padding-right: 16px; }
  .clock { display: none; }
}
