/* PIER Portál — navy + PIER logo blue (#4e819b) */
:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --text: #13212f;
  --muted: #5a6878;
  --line: #dde4ea;
  --navy: #0f2742;
  --navy-2: #173556;
  --pier: #4e819b;          /* logo colour: accents, icons, active nav */
  --pier-strong: #3a6a83;   /* buttons with white text (enough contrast) */
  --pier-soft: #e5eff3;
  --ok: #17784b; --ok-soft: #e3f5ec;
  --bad: #b3261e; --bad-soft: #fde9e7;
  --shadow: 0 1px 2px rgba(16, 32, 51, .06), 0 6px 18px rgba(16, 32, 51, .06);
  --radius: 12px;
  --f-head: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c131d; --panel: #131c28; --text: #e6edf5; --muted: #95a4b6; --line: #243245;
    --navy: #08101a; --navy-2: #142338; --pier: #7fb0c8; --pier-strong: #4e819b; --pier-soft: #17293a;
    --ok: #4fc98e; --ok-soft: #0f2c1f; --bad: #f2786d; --bad-soft: #3a1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--f-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--f-head); line-height: 1.2; margin: 0 0 .3em; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
a { color: var(--pier-strong); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- top bar ---------- */
.topbar { background: var(--navy); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 2px 10px rgba(0,0,0,.12); }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { display: block; height: 23px; width: auto; }
.brand-sep { width: 1px; height: 22px; background: rgba(255,255,255,.25); }
.brand-name { font: 700 17px/1 var(--f-head); letter-spacing: .01em; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: rgba(255,255,255,.75); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: #fff; background: var(--navy-2); }
.nav a.active { color: #fff; background: var(--navy-2); box-shadow: inset 0 -2px 0 var(--pier); }
.usermenu { display: flex; align-items: center; gap: 12px; }
.usermenu form { margin: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--pier); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.uname { font-weight: 500; }
.link-quiet { color: rgba(255,255,255,.7); text-decoration: none; font-size: 14px; }
.link-quiet:hover { color: #fff; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.btn-ghost:hover { background: var(--navy-2); }

/* ---------- page ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.back { display: inline-block; margin-bottom: 6px; text-decoration: none; font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty { padding: 32px; text-align: center; }

.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.msg { padding: 10px 14px; border-radius: 10px; background: var(--pier-soft); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.msg.error { background: var(--bad-soft); color: var(--bad); }

/* ---------- dashboard ---------- */
.hero { margin: 8px 0 26px; }
.hero h1 { font-size: 32px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 16px; min-height: 210px;
  padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); color: var(--text); text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 14px 14px 0 0; background: var(--pier); opacity: 0; transition: opacity .15s; }
a.tile:hover { transform: translateY(-2px); border-color: var(--pier); box-shadow: 0 10px 28px rgba(15, 39, 66, .12); }
a.tile:hover::before { opacity: 1; }
a.tile:focus-visible { outline: 3px solid var(--pier); outline-offset: 2px; }
.tile-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--pier-soft); color: var(--pier-strong); }
.tile-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile-title { font: 700 20px/1.2 var(--f-head); }
.tile-desc { color: var(--muted); font-size: 14px; }
.tile-go { color: var(--pier-strong); font-weight: 600; }
.tile.is-soon { cursor: default; }
.tile.is-soon .tile-icon { filter: grayscale(.6); opacity: .75; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 600; border: 1px solid var(--line); }

/* ---------- login ---------- */
body.is-login { background: radial-gradient(1200px 600px at 15% -10%, #1e4670 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(78,129,155,.45) 0%, transparent 60%), var(--navy); min-height: 100vh; }
body.is-login .page { padding: 0; max-width: none; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; padding: 32px 30px 26px; display: flex; flex-direction: column; gap: 16px; }
.login-head h1 { font-size: 30px; margin: 0; }
.login-head p { margin: 4px 0 0; }
.login-kicker { display: inline-block; font: 800 12px/1 var(--f-head); letter-spacing: .18em; color: var(--pier); margin-bottom: 6px; }

/* ---------- forms ---------- */
.form-card { max-width: 560px; padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-weight: 600; font-size: 14px; padding: 0; }
.field input[type=text], .field input[type=password], .field input:not([type]) {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; width: 100%;
}
.field input:focus { outline: none; border-color: var(--pier); box-shadow: 0 0 0 3px var(--pier-soft); }
.help { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); font-size: 13px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 9px; font-size: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checks .check { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; }
.check input { width: 17px; height: 17px; accent-color: var(--pier-strong); margin: 0; }
.checks ul, .checks li { list-style: none; margin: 0; padding: 0; }
.actions { display: flex; gap: 10px; margin-top: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 600 14px/1.2 var(--f-body); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--pier); }
.btn-primary { background: var(--pier-strong); border-color: var(--pier-strong); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-block { width: 100%; padding: 11px 16px; font-size: 15px; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* ---------- table ---------- */
.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-off td { color: var(--muted); }
.chip { display: inline-block; padding: 2px 9px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--pier-soft); color: var(--pier-strong); font-size: 12.5px; font-weight: 600; }
.chip-admin { background: var(--navy); color: #fff; }
.status { font-size: 13px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.off { color: var(--muted); }

/* ---------- narrow screens ---------- */
@media (max-width: 720px) {
  .topbar-in { padding: 0 16px; gap: 14px; }
  .uname, .link-quiet, .brand-sep, .brand-name { display: none; }
  .page { padding: 22px 16px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .table-card { overflow-x: auto; }
}
