:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #647080;
  --line: #d9dee6;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --ok: #16794c;
  --warn: #9a6700;
  --err: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 700; color: var(--text); font-size: 18px; }
nav { display: flex; gap: 18px; }
.page { padding: 28px; max-width: 1440px; margin: 0 auto; }
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; }
h2 { margin: 24px 0 12px; font-size: 18px; }
p { margin: 0; color: var(--muted); }
.actions, .tabs, .company-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.company-nav {
  margin: -8px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.company-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 6px;
  font-weight: 600;
}
.company-nav a.active {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}
.nav-model {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  color: var(--muted);
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.button:hover { background: var(--accent-dark); text-decoration: none; }
.button.secondary { background: white; color: var(--accent); }
.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.table-wrap.wide { max-height: 70vh; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { background: #eef1f5; color: #2b3645; font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.code { color: var(--muted); font-size: 12px; }
.position-name {
  padding-left: calc(var(--level, 0) * 18px);
  font-weight: 600;
}
.code-details {
  margin-top: 3px;
  padding-left: calc(var(--level, 0) * 18px);
  color: var(--muted);
  font-size: 12px;
}
.code-details summary {
  cursor: pointer;
  display: inline;
}
.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e8f0fe;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: help;
}
.ask-ai {
  display: inline-flex;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.muted { color: var(--muted); }
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.year-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.year-grid label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.tabs { margin: 12px 0; }
.tabs a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
}
.tabs a.active { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.panel, .meta-grid > div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.panel { display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 6px; }
textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  font: inherit;
}
.model-notes {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}
input[type="password"], input[type="file"] {
  width: 100%;
  min-height: 38px;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-box {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.ai-result {
  margin-top: 18px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.fallback-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #f0d38a;
  background: #fff8e5;
  border-radius: 6px;
}
.fallback-box p { margin-top: 6px; }
.fallback-box ul { margin: 8px 0 0; padding-left: 20px; }
.current-model {
  margin: -6px 0 16px;
  padding: 10px 12px;
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
}
.markdown-text {
  margin-top: 10px;
  white-space: pre-wrap;
  line-height: 1.55;
}
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.meta-grid strong { display: block; margin-bottom: 5px; }
.meta-grid span { color: var(--muted); }
.status {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef1f5;
  font-weight: 700;
}
.status.ok { color: var(--ok); background: #e7f5ee; }
.status.warning { color: var(--warn); background: #fff4d6; }
.status.error { color: var(--err); background: #fde8e7; }
.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #f3c2c2;
  background: #fff0f0;
  color: var(--err);
  border-radius: 8px;
}
code { background: #eef1f5; padding: 2px 5px; border-radius: 4px; }

@media (max-width: 720px) {
  .topbar, .section-head { align-items: stretch; flex-direction: column; }
  .page { padding: 18px; }
  h1 { font-size: 24px; }
}
