/* FinTrackIP — mobile-first базовые стили */
:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #1a1d26;
  --muted: #5c6370;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --nav-h: 56px;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #1a1d26;
  --text: #eef0f4;
  --muted: #9aa3b5;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
}

@media (min-width: 900px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.app-main {
  padding: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 1rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}
.btn-secondary {
  background: var(--muted);
}
.btn-block {
  width: 100%;
}
.btn-danger {
  background: var(--danger);
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  border-color: #374151;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
[data-theme="dark"] .alert-error {
  background: #3f1d1d;
  color: #fecaca;
  border-color: #7f1d1d;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.grid-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
@media (min-width: 600px) {
  .grid-actions {
    grid-template-columns: repeat(4, 1fr);
  }
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--surface);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.35rem;
}
.bottom-nav a.active {
  color: var(--accent);
  font-weight: 700;
}

@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }
  .desktop-nav {
    display: flex !important;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .desktop-nav a {
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--muted);
  }
  .desktop-nav a:hover {
    background: var(--bg);
    text-decoration: none;
  }
}

.desktop-nav {
  display: none;
}

.install-steps {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.install-steps span.on {
  color: var(--accent);
  font-weight: 700;
}
