/* HYDRA prototype — shared styles. Brand: Heves Megyei Vízmű (navy + teal). */

:root {
  --navy: #003263;
  --navy-dark: #002F5C;
  --navy-800: #0a3f73;
  --navy-700: #154f86;
  --teal: #00C6BE;
  --teal-light: #0DE2B8;
  --info: #0F8FFF;
  --ok: #2ED397;
  --warn: #FF8A00;
  --bad: #FF1053;
  --ink: #1f2d3d;
  --ink-soft: #5a6b7b;
  --line: #e4e9ef;
  --bg: #f4f7fa;
  --sidebar-w: 248px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-heading { font-family: 'Montserrat', 'Nunito', sans-serif; }

/* ---------- App layout ---------- */
.app-main {
  min-height: 100vh;
  transition: margin-left .25s ease;
}
@media (min-width: 1024px) {
  .app-main { margin-left: var(--sidebar-w); }
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #cfe0f0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: 0 0 40px rgba(0,0,0,.18);
}
#sidebar.open { transform: translateX(0); }
@media (min-width: 1024px) {
  #sidebar { transform: translateX(0); box-shadow: none; }
}
.sb-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sb-brand img { height: 38px; width: auto; }
.sb-brand .wordmark { line-height: 1; }
.sb-brand .wordmark b { font-family: 'Montserrat'; font-weight: 700; color: #fff; font-size: 1.15rem; letter-spacing: .02em; display: block; }
.sb-brand .wordmark span { font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--teal-light); }
.sb-nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.sb-section { font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: #6f8db0; padding: 1rem .85rem .4rem; }
.sb-link {
  display: flex; align-items: center; gap: .8rem;
  padding: .62rem .85rem; margin: .12rem 0;
  border-radius: 10px; color: #c4d6ea;
  font-weight: 600; font-size: .92rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.sb-link svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.sb-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-link.active { background: var(--teal); color: var(--navy-dark); box-shadow: 0 6px 16px rgba(0,198,190,.3); }
.sb-link.active svg { opacity: 1; }
.sb-link .pill { margin-left: auto; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 800; padding: .05rem .4rem; border-radius: 99px; }
.sb-link.active .pill { background: var(--navy-dark); }
.sb-foot { padding: .85rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .72rem; color: #6f8db0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .9rem;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: .7rem 1rem;
}
@media (min-width: 1024px) { .topbar { padding: .85rem 1.75rem; } }
.topbar h1 { font-size: 1.15rem; margin: 0; color: var(--navy); font-weight: 700; }
.topbar .sub { font-size: .78rem; color: var(--ink-soft); font-weight: 600; }
.burger { display: inline-flex; }
@media (min-width: 1024px) { .burger { display: none; } }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--navy); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }

.page-wrap { padding: 1.1rem 1rem 5rem; }
@media (min-width: 1024px) { .page-wrap { padding: 1.75rem; } }
@media (min-width: 1280px) { .page-wrap { max-width: 1280px; } }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.card-pad { padding: 1.15rem 1.25rem; }

.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 1.1rem 1.15rem; position: relative; overflow: hidden;
}
.stat::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--teal); }
.stat.is-bad::before { background: var(--bad); }
.stat.is-warn::before { background: var(--warn); }
.stat.is-ok::before { background: var(--ok); }
.stat.is-info::before { background: var(--info); }
.stat .label { font-size: .78rem; color: var(--ink-soft); font-weight: 700; }
.stat .value { font-family:'Montserrat'; font-weight: 700; font-size: 2rem; color: var(--navy); line-height: 1.1; margin-top: .15rem; }
.stat .meta { font-size: .74rem; margin-top: .35rem; font-weight: 600; }
.stat .ico { position:absolute; right: .9rem; top: .9rem; opacity: .12; }
.stat .ico svg { width: 42px; height: 42px; color: var(--navy); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .73rem; font-weight: 800; padding: .2rem .6rem; border-radius: 99px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.badge.ok   { color: #0c8a5b; background: #e6faf1; }
.badge.warn { color: #b25b00; background: #fff3e0; }
.badge.bad  { color: #c10a3e; background: #ffe6ed; }
.badge.info { color: #0a5fb0; background: #e6f2ff; }
.badge.muted{ color: #5a6b7b; background: #eef2f6; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content:center; gap: .5rem;
  font-weight: 700; font-size: .9rem; padding: .6rem 1rem; border-radius: 11px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-teal { background: var(--teal); color: var(--navy-dark); }
.btn-teal:hover { background: #00b3ab; }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: .42rem .7rem; font-size: .82rem; border-radius: 9px; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 800; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover { background: #f7fafd; }
.tbl tbody tr:last-child td { border-bottom: none; }
.mono { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }

/* ---------- Inputs ---------- */
.inp {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 11px;
  padding: .6rem .85rem; font-family: inherit; font-size: .92rem; background:#fff; color: var(--ink);
}
.inp:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,198,190,.15); }

/* ---------- Checklist ---------- */
.check-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem .95rem; border: 1px solid var(--line); border-radius: 13px; background:#fff;
  cursor: pointer; transition: .12s; user-select: none;
}
.check-row + .check-row { margin-top: .55rem; }
.check-row:hover { border-color: #cfd9e3; }
.seg { display: inline-flex; border:1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { border: none; background:#fff; padding: .4rem .6rem; cursor: pointer; font-weight: 800; font-size: .8rem; color: var(--ink-soft); display:flex; align-items:center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on-ok  { background: var(--ok); color:#063; }
.seg button.on-warn{ background: var(--warn); color:#5a2d00; }
.seg button.on-bad { background: var(--bad); color:#fff; }
.check-label { font-weight: 600; font-size: .95rem; flex: 1; }

.timeline { position: relative; padding-left: 1.4rem; }
.timeline::before { content:""; position:absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 1.1rem; }
.tl-item::before { content:""; position:absolute; left: -1.4rem; top: 3px; width: 13px; height: 13px; border-radius: 99px; background:#fff; border: 3px solid var(--teal); }
.tl-item.bad::before { border-color: var(--bad); }
.tl-item.warn::before { border-color: var(--warn); }

.scrim { position: fixed; inset: 0; background: rgba(8,20,35,.45); z-index: 55; opacity:0; pointer-events:none; transition: opacity .2s; }
.scrim.show { opacity:1; pointer-events:auto; }
@media (min-width: 1024px) { .scrim { display:none; } }

.kv { display:grid; grid-template-columns: max-content 1fr; gap: .45rem 1.1rem; font-size: .9rem; }
.kv dt { color: var(--ink-soft); font-weight: 700; }
.kv dd { margin:0; font-weight: 600; }

.toast {
  position: fixed; bottom: 1.3rem; left: 50%;
  transform: translateX(-50%) translateY(160%);
  background: var(--navy); color: #fff; padding: .85rem 1.25rem; border-radius: 12px;
  font-weight: 700; font-size: .92rem; max-width: calc(100vw - 2rem);
  box-shadow: 0 12px 34px rgba(0,0,0,.28); z-index: 90;
  opacity: 0; visibility: hidden; transition: transform .3s, opacity .3s;
  display: flex; align-items: center; gap: .6rem;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--teal-light); flex: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

.fade-up { animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(8,20,35,.5); z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-scrim { align-items: center; padding: 1.5rem; } }
.modal-card { background: #fff; width: 100%; max-width: 580px; max-height: 94vh; overflow: auto; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
@media (min-width: 640px) { .modal-card { border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h3 { margin: 0; color: var(--navy); font-size: 1.15rem; }
.modal-body { padding: 1.25rem; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); display: flex; gap: .6rem; justify-content: flex-end; position: sticky; bottom: 0; background: #fff; }
.form-grid { display: grid; gap: .9rem; grid-template-columns: 1fr 1fr; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .76rem; font-weight: 800; color: var(--navy); display: block; margin-bottom: .3rem; }
.x-close { width: 34px; height: 34px; border-radius: 9px; border: none; background: var(--bg); color: var(--ink-soft); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: 14px; padding: 2rem 1rem; text-align: center; color: var(--ink-soft); font-weight: 700; cursor: pointer; transition: .15s; }
.dropzone:hover { border-color: var(--teal); background: #f0fdfc; color: var(--navy); }
