:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e4e7ec;
  --text: #1d2939;
  --muted: #667085;
  --accent: #465fff;
  --accent-hover: #3641f5;
  --accent-soft: #ecefff;
  --accent-contrast: #ffffff;
  --ok: #12b76a;
  --err: #f04438;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.05);
  --maxw: 900px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101828;
    --surface: #1d2939;
    --surface-2: #182130;
    --border: #344054;
    --text: #f2f4f7;
    --muted: #98a2b3;
    --accent: #5b76ff;
    --accent-hover: #728aff;
    --accent-soft: #1f2942;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

iconify-icon { display: inline-flex; vertical-align: -0.15em; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

/* --- topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand iconify-icon { color: var(--accent); font-size: 22px; }
.topbar-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.topbar-nav .btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn iconify-icon { font-size: 18px; }
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-contrast); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-block { width: 100%; }

main { flex: 1 0 auto; padding: 40px 0 72px; }

/* --- hero --- */
.hero { text-align: center; padding: 56px 0 40px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 22px;
}
.hero h1 { margin: 0 0 14px; font-size: 44px; font-weight: 700; letter-spacing: -0.02em; }
.hero p { margin: 0 auto; max-width: 540px; color: var(--muted); font-size: 16px; }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* --- cards grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

/* --- sections --- */
.section { margin-top: 52px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-title h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.section-title a { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }

/* --- news --- */
.news-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.news-item:hover { border-color: var(--muted); }
.news-item img { width: 100%; height: 160px; object-fit: cover; display: block; }
.news-item .body { padding: 16px 18px; }
.news-item .cat { font-size: 12px; font-weight: 500; color: var(--accent); margin-bottom: 4px; }
.news-item h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }
.news-item h3 a { color: var(--text); }
.news-item h3 a:hover { color: var(--accent); }

/* --- panel (forms) --- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 26px;
}
.panel h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; text-align: center; }
.panel .hint { margin: 0 0 22px; color: var(--muted); font-size: 14px; text-align: center; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: var(--muted); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }

.form-msg { font-size: 14px; margin-top: 14px; min-height: 18px; text-align: center; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }

/* --- footer --- */
footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* --- centered system page (errors / maintenance) --- */
.center-page {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.center-card { text-align: center; max-width: 420px; }
.center-card .status-icon { font-size: 56px; color: var(--muted); }
.center-card .code { font-size: 64px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 0; }
.center-card h1 { font-size: 24px; font-weight: 600; margin: 8px 0 0; }
.center-card p { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.center-card .rid { font-size: 12px; color: var(--muted); opacity: 0.7; margin-top: 14px; }
.center-card .actions { margin-top: 24px; }

@media (max-width: 560px) {
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 34px; }
  .brand span { display: none; }
}
