/* ============================================================
   UrielChat — design system (tema UrielSec)
   Palette deep navy / gun-metal / steel-blue, zero risorse esterne.
   ============================================================ */

:root {
  --bg: #05080f;
  --bg-2: #0a1120;
  --bg-elev: rgba(12, 19, 34, 0.84);
  --bg-elev2: rgba(18, 28, 48, 0.92);
  --line: rgba(127, 163, 217, 0.18);
  --line-strong: rgba(127, 163, 217, 0.42);
  --line-soft: rgba(127, 163, 217, 0.11);

  --steel: #7fa3d9;
  --steel-bright: #b3caef;
  --steel-deep: #3f6aa8;
  --metal: #2a3346;

  --text: #dbe3f0;
  --text-dim: #8b9bb4;
  --text-faint: #6c7e99;

  --accent: var(--steel);
  --accent-dim: var(--steel-deep);
  --accent-bright: var(--steel-bright);
  --accent-glow: rgba(127, 163, 217, 0.28);
  --cyan: var(--steel-bright);
  --danger: #e0606b;
  --ok: #5fd49a;
  --amber: #e6b553;

  --radius: 6px;
  --radius-sm: 4px;
  --cut: 10px;
  --display: "Bahnschrift", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, Menlo, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 45% at 50% 0%, rgba(80, 120, 190, 0.16), transparent 68%),
    linear-gradient(rgba(127, 163, 217, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 163, 217, 0.032) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

::selection { background: var(--steel-deep); color: #fff; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }

h1, h2, h3 { margin: 0; font-weight: 600; font-family: var(--display); letter-spacing: 0.015em; }

/* ---------- bottoni ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-elev2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease, background .18s ease, border-color .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); filter: brightness(1.1); }
.btn-primary {
  background: linear-gradient(135deg, #4a76b6, #2d4f84);
  color: #ffffff;
  border-color: transparent;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  box-shadow: 0 4px 18px rgba(45, 79, 132, 0.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #5b88c9, #365c96); }
.btn-ghost {
  background: rgba(127, 163, 217, 0.06);
  border-color: var(--line-strong);
  color: var(--steel-bright);
}
.btn-ghost:hover { background: rgba(127, 163, 217, 0.14); }
.btn-danger {
  background: rgba(224, 96, 107, 0.08);
  border-color: rgba(224, 96, 107, 0.55);
  color: var(--danger);
}
.btn-danger-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--danger);
}
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--steel-bright);
  font-size: 20px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: rgba(127, 163, 217, 0.08); border-color: var(--line); }
.icon-btn:active { background: rgba(127, 163, 217, 0.16); border-color: var(--line-strong); }

/* ---------- form ---------- */

.field {
  display: block;
  margin: 0 0 14px;
  text-align: left;
}
.field > span {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input[type="text"], input[type="url"], input[type="password"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(7, 12, 22, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--steel);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
textarea { resize: none; font-family: var(--mono); font-size: 13px; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.toggle-row input { accent-color: var(--steel-deep); width: 18px; height: 18px; flex: none; }

/* ---------- barre, sheet & toast ---------- */

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  background: rgba(10, 17, 32, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-strong);
  padding: 18px 14px calc(18px + var(--sab));
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 60;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.55);
}
.sheet::before {
  content: "";
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: -8px auto 8px;
}
.sheet button {
  text-align: left;
  padding: 13px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.sheet button:active { background: rgba(127, 163, 217, 0.12); border-color: var(--line); }
.sheet button.danger { color: var(--danger); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 10, 0.68);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--sab));
  transform: translateX(-50%);
  background: rgba(12, 19, 34, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 13px;
  z-index: 70;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  margin-right: 6px;
  flex: none;
}
.dot-ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot-warn { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot-off { background: var(--text-faint); }

.mono-small {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-dim);
  word-break: break-all;
}
