/* Shared look for foundry-companion web apps: dark, phone-first, big touch targets. */

:root {
  color-scheme: dark;
  --bg: #111318;
  --surface: #1b1e26;
  --surface-2: #252935;
  --border: #323746;
  --text: #e8eaf0;
  --muted: #9097a8;
  --accent: #6aa8ff;
  --ok: #46c46e;
  --warn: #e3a33b;
  --danger: #e5534b;
  --radius: 14px;
  --tap: 48px;
  /* Shared content column: headers and content line up at every width, centered on tablets. */
  --content-max: 1200px;
  /* Horizontal padding for full-width rows (direct children of body) so their content sits in the column. */
  --gutter: max(16px, calc((100% - var(--content-max)) / 2 + 16px));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.muted {
  color: var(--muted);
}

button,
.button {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1220;
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input[type="range"] {
  width: 100%;
  height: var(--tap);
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
  touch-action: pan-y;
}

input[type="range"]:disabled {
  opacity: 0.4;
}

/* Connection pill: data-state = connecting | online | offline | unreachable | unauthorized */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pill[data-state="online"] {
  color: var(--ok);
}

.pill[data-state="offline"],
.pill[data-state="connecting"] {
  color: var(--warn);
}

.pill[data-state="unreachable"],
.pill[data-state="unauthorized"] {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.4);
  z-index: 10;
}

[hidden] {
  display: none !important;
}
