:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1c1e21;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-light: #eff4ff;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --error-border: #fecaca;
  --radius: 14px;
  --warn-bg: #fffbeb;
  --warn-text: #92400e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --card-bg: #1e2126;
    --text: #f0f1f3;
    --text-muted: #9aa0ab;
    --border: #2c3036;
    --primary: #5b8def;
    --primary-light: #1c2636;
    --error-bg: #2a1616;
    --error-text: #f87171;
    --error-border: #4c1f1f;
    --date-icon-filter: invert(1);
    --warn-bg: #2a2413;
    --warn-text: #fbbf24;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --card-bg: #1e2126;
  --text: #f0f1f3;
  --text-muted: #9aa0ab;
  --border: #2c3036;
  --primary: #5b8def;
  --primary-light: #1c2636;
  --error-bg: #2a1616;
  --error-text: #f87171;
  --error-border: #4c1f1f;
  --date-icon-filter: invert(1);
  --warn-bg: #2a2413;
  --warn-text: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb .lang-link {
  float: right;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 1.6rem;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.intro {
  color: var(--text-muted);
  margin: 10px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ad-slot-top {
  margin-bottom: 20px;
}

.ad-slot-bottom {
  margin-top: 20px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.15s ease;
}

.input-group:focus-within {
  border-color: var(--primary);
}

.input-group input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  min-width: 0;
}

.input-group input::-webkit-calendar-picker-indicator {
  filter: var(--date-icon-filter, none);
  cursor: pointer;
}

.input-group input:focus {
  outline: none;
}

.input-group .unit {
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-left: 1px solid var(--border);
  align-self: stretch;
  display: flex;
  align-items: center;
}

.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.error.hidden {
  display: none;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  line-height: 1.45;
}

.hint.ok {
  color: var(--primary);
  font-weight: 600;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0 !important;
  font-weight: 400 !important;
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.input-group input:disabled {
  opacity: 0.45;
}

.combo {
  position: relative;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
}

.suggestions.hidden {
  display: none;
}

.suggestions li {
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
}

.suggestions li small {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.suggestions li[aria-selected="true"],
.suggestions li:hover {
  background: var(--primary-light);
}

.suggestions li.empty {
  color: var(--text-muted);
  cursor: default;
}

.manual {
  margin-top: 12px;
  font-size: 0.85rem;
}

.manual summary {
  cursor: pointer;
  color: var(--text-muted);
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.manual-grid label {
  font-size: 0.75rem !important;
}

.btn {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

.result {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

.result.hidden {
  display: none;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.result-item + .result-item {
  border-left: 1px solid var(--border);
}

.result-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-symbol {
  font-size: 2.2rem;
  line-height: 1.2;
  margin-top: 6px;
  color: var(--primary);
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "DejaVu Sans", sans-serif;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.result-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-text {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.55;
}

.result-warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.8rem;
  line-height: 1.45;
}

.result-warning.hidden {
  display: none;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 20px;
}

@media (max-width: 420px) {
  .manual-grid {
    grid-template-columns: 1fr 1fr;
  }
  .result-value {
    font-size: 1.25rem;
  }
}
