/* AMG Marketing Hub — палитра и шрифты из брендбука Archimedes */
:root {
  --brand: #00607C;
  --brand-2: #008393;
  --brand-3: #00A598;
  --brand-4: #00B2BD;
  --accent: #F9F871;
  --grey: #6D6D6C;
  --ink: #13303A;
  --ink-2: #3C5A64;
  --muted: #5E7880;
  --bg: #F4F8F9;
  --card: #FFFFFF;
  --line: #D5E3E7;
  --soft: #E3F1F2;
  --good: #1E7F4F;
  --warn: #9A6B00;
  --bad: #B3261E;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(19, 48, 58, .06), 0 4px 16px rgba(19, 48, 58, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Open Sans", Arial, sans-serif; font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
}
h1, h2, h3, h4, .brandfont { font-family: "Onest", Arial, sans-serif; color: var(--ink); margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

/* layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #E6F3F5; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { font-family: "Onest", sans-serif; font-weight: 700; font-size: 19px; color: #fff; display: block; padding: 4px 10px 16px; }
.side .logo span { display: block; font-size: 12px; font-weight: 400; color: var(--accent); letter-spacing: 1px; text-transform: uppercase; }
.side h4 { color: #9FD0D8; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; margin: 18px 10px 6px; font-family: "Onest", sans-serif; }
.side a { display: flex; justify-content: space-between; align-items: center; color: #E6F3F5; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.side a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.side a.on { background: #fff; color: var(--brand); font-weight: 600; }
.side .badge { background: var(--accent); color: var(--ink); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.side .me { margin-top: 22px; padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.18); font-size: 13px; color: #BFDDE3; }
.side .me b { color: #fff; display: block; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar p { margin: 4px 0 0; color: var(--ink-2); max-width: 820px; }
.menu-btn { display: none; }

/* cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.btn.menu-btn { display: none; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.kpi { border-top: 5px solid var(--brand); }
.kpi .label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-family: "Onest", sans-serif; font-weight: 600; }
.kpi .val { font-family: "Onest", sans-serif; font-size: 30px; font-weight: 700; color: var(--brand); margin: 6px 0 2px; }
.kpi .empty { color: var(--muted); font-size: 14px; margin-top: 8px; }
.delta-good { color: var(--good); font-weight: 600; }
.delta-bad { color: var(--bad); font-weight: 600; }
.alert-list a { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.alert-list a:last-child { border-bottom: 0; }
.alert-list b { font-family: "Onest", sans-serif; color: var(--brand); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--soft); }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.amg td { background: #EAF6F7; font-weight: 600; }

/* forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 8px 16px; border-radius: 10px; font: 600 14px "Open Sans", sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover { background: #004E66; text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.accent { background: var(--accent); border-color: #E3E15A; color: var(--ink); }
form.f p, .field { margin: 0 0 14px; }
form.f label, .field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--ink-2); }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=email], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: 14px "Open Sans", sans-serif; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-4); border-color: var(--brand-4); }
input:disabled, select:disabled, textarea:disabled { background: #F7FAFB; color: var(--ink-2); }
.helptext, form.f .helptext { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
ul.errorlist { color: var(--bad); margin: 4px 0; padding-left: 18px; font-size: 13px; }
form.f ul:not(.errorlist) { list-style: none; padding: 0; margin: 0; columns: 3; }
form.f ul:not(.errorlist) li label { font-weight: 400; display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .wide { grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 160px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: #E1F4EA; color: var(--good); }
.pill-warn { background: #FFF6D6; color: var(--warn); }
.pill-bad { background: #FBE4E2; color: var(--bad); }
.pill-main { background: #DDF0F4; color: var(--brand); }
.pill-muted { background: #EEF2F3; color: var(--muted); }
.r-good { color: var(--good); font-weight: 700; } .r-ok { color: var(--brand); font-weight: 700; }
.r-mid { color: var(--warn); font-weight: 700; } .r-bad { color: var(--bad); font-weight: 700; }

/* messages */
.msgs { list-style: none; padding: 0; margin: 0 0 16px; }
.msgs li { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; border: 1px solid; }
.msgs .success { background: #E1F4EA; border-color: #BFE3CF; color: #14563A; }
.msgs .warning { background: #FFF6D6; border-color: #F0DE9C; color: #6B4B00; }
.msgs .error { background: #FBE4E2; border-color: #F3C2BD; color: #8A1C15; }
.note { background: var(--soft); border-left: 4px solid var(--brand-3); padding: 10px 14px; border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.warnbox { background: #FFF6D6; border-left: 4px solid #E0B800; padding: 10px 14px; border-radius: 8px; font-size: 14px; }

/* kanban & calendar */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.col { background: #EAF1F3; border-radius: 12px; padding: 10px; min-height: 120px; }
.col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; justify-content: space-between; }
.pcard { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; color: var(--ink); font-size: 13px; }
.pcard:hover { border-color: var(--brand-4); text-decoration: none; }
.pcard b { display: block; font-size: 14px; margin-bottom: 3px; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 12px; color: var(--muted); padding: 6px; text-transform: uppercase; }
.cal td { border: 1px solid var(--line); height: 110px; vertical-align: top; padding: 6px; background: #fff; }
.cal td.empty { background: #F0F4F5; }
.cal .d { font-size: 12px; color: var(--muted); font-weight: 700; }
.cal a.ev { display: block; font-size: 12px; background: var(--soft); border-left: 3px solid var(--brand-3); padding: 2px 6px; border-radius: 4px; margin-top: 4px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* brand */
.swatch { border-radius: 12px; height: 92px; border: 1px solid var(--line); display: flex; align-items: flex-end; padding: 10px; font-family: "Onest", sans-serif; font-weight: 700; }
.doc { max-width: 900px; }
.doc table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.doc th { background: var(--soft); }
.doc pre { background: var(--soft); padding: 12px; border-radius: 8px; overflow-x: auto; }
.qr svg { width: 220px; height: 220px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--brand); padding: 16px; }
.login-card { background: #fff; border-radius: 18px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; height: 100vh; }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; margin-bottom: 10px; }
  .main { padding: 16px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  form.f ul:not(.errorlist) { columns: 1; }
}
@media print {
  .side, .no-print, .menu-btn { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
