/* Shared styles for all utilities.
   Tool-specific styling belongs in a <style> block on the tool's own page. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef1;
  --border: #d6d9df;
  --text: #1d2127;
  --text-muted: #687078;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --on-accent: #ffffff;
  --danger: #c0392b;
  --radius: 8px;
  --space: 16px;
  --max-width: 980px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1e2128;
    --surface-2: #262a32;
    --border: #353a44;
    --text: #e6e8ec;
    --text-muted: #969ca6;
    --accent: #5b9bf8;
    --accent-hover: #74acf9;
    --on-accent: #0d1117;
    --danger: #e06c5b;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space);
}

/* --- header ------------------------------------------------------------- */

.page-header { margin: 8px 0 24px; }
.page-header h1 { margin: 0; font-size: 1.6rem; }
.subtitle { margin: 4px 0 0; color: var(--text-muted); }

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.back-link:hover { text-decoration: underline; }

/* --- landing page cards ------------------------------------------------- */

.card-grid {
  display: grid;
  gap: var(--space);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  display: block;
  padding: var(--space);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h2 { margin: 0 0 6px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.empty { color: var(--text-muted); }

/* --- panels ------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
}

/* --- forms -------------------------------------------------------------- */

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 14px;
}
fieldset:last-child { margin-bottom: 0; }
legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 10px;
}
.row:last-child { margin-bottom: 0; }
.row > label {
  flex: 0 0 116px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.row > input,
.row > select { flex: 1 1 160px; min-width: 0; }

input[type="text"],
select,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
}
textarea { font-family: var(--mono); }
input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
input:disabled,
select:disabled { opacity: 0.5; cursor: not-allowed; }

.mono { font-family: var(--mono); }

/* checkbox rows */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.check:last-child { margin-bottom: 0; }
.check.sub { margin-left: 26px; }
.check:has(input:disabled) { opacity: 0.5; }
.row:has(input:disabled) > label,
.row:has(select:disabled) > label { opacity: 0.6; }

/* --- buttons ------------------------------------------------------------ */

button {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* --- misc --------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.badge-error { color: var(--on-accent); background: var(--danger); }

.hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
