:root {
  color-scheme: light;
  --background: #f4f1ea;
  --foreground: #17211d;
  --card: #ffffff;
  --card-foreground: #17211d;
  --primary: #173f32;
  --primary-foreground: #ffffff;
  --secondary: #e6e0d5;
  --secondary-foreground: #25352e;
  --muted: #e9e5dc;
  --muted-foreground: #65716b;
  --accent: #efe5d2;
  --accent-foreground: #47351b;
  --destructive: #a52e2e;
  --border: #d8d2c7;
  --input: #cbc5ba;
  --ring: #c9893e;
  --viz-series-1: #c9893e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--background); }

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  padding: calc(16px + var(--safe-top)) 14px calc(22px + var(--safe-bottom));
  background:
    linear-gradient(180deg, rgba(201, 137, 62, 0.08), transparent 220px),
    var(--background);
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }

#elektra-opname-app { max-width: 860px; margin: 0 auto; }

h1, h2, h3 { letter-spacing: -0.025em; }
h2 { font-size: clamp(1.45rem, 5vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.08rem; line-height: 1.3; }
p { margin: 0.65rem 0; }
strong { font-weight: 700; }

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: 0 12px 30px rgba(23, 33, 29, 0.07);
}

.viz-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.viz-stat-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.viz-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 0.82rem;
  font-weight: 700;
}

.text-small { font-size: 0.82rem; }
.text-muted { color: var(--muted-foreground); }
.text-destructive { color: var(--destructive); }
.text-end { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  color: var(--foreground);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .form-control:focus, .form-select:focus {
  outline: 3px solid color-mix(in srgb, var(--ring) 35%, transparent);
  outline-offset: 1px;
}
.btn-primary { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: #0f3026; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted-foreground); }
.btn[hidden] { display: none; }

.form-label { display: grid; gap: 6px; color: var(--foreground); font-size: 0.92rem; font-weight: 700; }
.form-control, .form-select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--input);
  border-radius: 10px;
  background: var(--card);
  color: var(--foreground);
  font-weight: 500;
}
.form-control::placeholder { color: var(--muted-foreground); font-weight: 400; }
.form-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.form-check-input { width: 20px; height: 20px; accent-color: var(--primary); }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; background: transparent; }
.table th, .table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.table th { color: var(--muted-foreground); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.035em; }
.table .text-end { text-align: right; }
.table-sm th, .table-sm td { padding: 9px 8px; }

@media (max-width: 580px) {
  body { padding-left: 10px; padding-right: 10px; }
  #elektra-opname-app .app-panel { padding: 12px 4px; }
  .btn { min-height: 50px; }
  .table th, .table td { white-space: nowrap; }
}

@media print {
  body { background: #fff; padding: 0; }
  .app-status, .actions, .result-tabs { display: none !important; }
  #elektra-opname-app { max-width: none; }
}
