:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c2024;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #1f5eff;
  --red: #c4283a;
  --red-bg: #fdeced;
  --yellow: #9a6700;
  --yellow-bg: #fff6dd;
  --green: #1a7f47;
  --green-bg: #e8f6ee;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* Свои display-правила (.login, .app) перебивают атрибут hidden из UA-стилей,
   поэтому скрытые блоки продолжали рендериться. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.hint { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user { color: var(--muted); font-size: 14px; }

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 24px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.form { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], input:not([type]) {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  background: #fff;
  color: inherit;
  width: 100%;
}

input:focus { outline: 2px solid rgba(31, 94, 255, 0.35); border-color: var(--accent); }

.sender {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sender legend { font-size: 13px; color: var(--muted); padding: 0 6px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox input { width: 16px; height: 16px; }

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
}

.primary:disabled { opacity: 0.6; cursor: default; }

.result { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }

.verdict {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.verdict.red { background: var(--red-bg); color: var(--red); }
.verdict.yellow { background: var(--yellow-bg); color: var(--yellow); }
.verdict.green { background: var(--green-bg); color: var(--green); }
.verdict strong { font-size: 17px; }
.verdict span { font-size: 14px; }

.card-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.card-meta { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.props { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 16px; font-size: 14px; margin-bottom: 20px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; }

.flags { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.flag {
  border-left: 3px solid;
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 14px;
}

.flag.red { border-color: var(--red); background: var(--red-bg); }
.flag.yellow { border-color: var(--yellow); background: var(--yellow-bg); }
.flag.green { border-color: var(--green); background: var(--green-bg); }
.flag .detail { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

.section-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 20px 0 10px; }

.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.checklist-item input { margin-top: 3px; width: 16px; height: 16px; flex: none; }
.checklist-item.done span { color: var(--muted); text-decoration: line-through; }

.side-heading { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

.search-results { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }

.search-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 7px 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.search-item:hover { background: var(--bg); }
.search-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-meta { font-size: 12px; color: var(--muted); }

.recent { display: flex; flex-direction: column; gap: 10px; }
.recent-item { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.dot.red { background: var(--red); }
.dot.yellow { background: #d4a017; }
.dot.green { background: var(--green); }
.recent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { color: var(--muted); font-size: 12px; flex: none; }
.empty { color: var(--muted); font-size: 14px; }

.error { color: var(--red); font-size: 14px; }

.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .primary { align-self: stretch; text-align: center; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .props { grid-template-columns: 1fr; gap: 2px 0; }
  .props dd { margin-bottom: 8px; }
}
