/* ==========================================================================
   style.css — design tokens, base typography, app shell (sidebar / topbar), home page.
   Component styles (forms, tables, chips, modal ...) live in components.css.

   BRAND: these colours are a STAND-IN (bordeaux / brass / warm white). Exact venec.mk values could not
   be read from the build environment. To match the real brand, change ONLY the :root block below
   and drop the real logo into public/img/logo.svg (a light-on-dark version for the sidebar).
   ========================================================================== */

:root {
  --wine: #5b1a2c;
  --wine-dark: #431320;
  --wine-tint: #f4e9ec;
  --brass: #b08a4a;
  --brass-tint: #f6efe1;
  --bg: #ffffff;
  --surface: #ffffff;
  --tint: #f8f4ef;
  --ink: #2b2523;
  --muted: #6f6560;
  --line: #e4dcd2;
  --ok: #1f6b3a;
  --ok-tint: #e5f2e9;
  --warn: #8a5a00;
  --warn-tint: #fbf0d6;
  --danger: #9b2c2c;
  --danger-tint: #fbe9e9;

  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 248px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; color: var(--wine-dark); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--wine); }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--wine); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 8px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { padding: 28px 36px 64px; max-width: 1180px; width: 100%; }

.topbar, .sidebar-backdrop { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--wine); color: #f3e7df;
  padding: 22px 14px 16px;
}
.brand { display: block; text-decoration: none; color: inherit; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.14); margin-bottom: 14px; }
.brand-logo { display: block; width: 150px; height: auto; }
.brand-sub { display: block; margin-top: 8px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: #d9c3a0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 16px 10px 6px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #cdb08a; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: #f3e7df; text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.1); }
.nav-link.active { background: #f8f1e8; color: var(--wine-dark); font-weight: 700; }

.sidebar-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid rgba(255,255,255,.14); }
.whoami { display: flex; flex-direction: column; color: #fff; text-decoration: none; padding: 4px 8px; border-radius: 8px; }
.whoami:hover { background: rgba(255,255,255,.08); }
.whoami strong { font-size: .95rem; overflow-wrap: anywhere; }
.whoami span { font-size: .8rem; color: #d9c3a0; }
.sidebar-foot form { margin: 0; }
.sidebar-foot .btn { width: 100%; }

.lang-pill { display: inline-flex; align-self: flex-start; margin-left: 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; overflow: hidden; }
.lang-pill a { padding: 6px 14px; min-height: 32px; color: #f3e7df; text-decoration: none; font-size: .8rem; font-weight: 700; letter-spacing: .06em; }
.lang-pill a.active { background: #f8f1e8; color: var(--wine-dark); }

/* ---------- Page heading + flash ---------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: .25em; }
.page-lede, .lede { color: var(--muted); max-width: 70ch; margin: 0; }
.crumb { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-bottom: 4px; text-decoration: none; font-weight: 600; }
.crumb .icon { width: 18px; height: 18px; }

.flash { padding: 12px 16px; margin: 0 0 18px; border-radius: 10px; border: 1px solid var(--line); border-left-width: 5px; background: var(--tint); }
.flash-success { background: var(--ok-tint); border-color: #b7dcc3; border-left-color: var(--ok); color: #164f2b; }
.flash-error { background: var(--danger-tint); border-color: #efc3c3; border-left-color: var(--danger); color: #7a2020; }

/* ---------- Home ---------- */
.home-hero { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.home-tagline { font-family: var(--font-serif); font-style: italic; font-size: 1.15rem; color: var(--brass); margin: 0 0 .5em; }
.tile-section { margin-bottom: 30px; }
.tile-section h2 { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-family: var(--font-sans); font-weight: 700; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: inherit; min-height: 44px; }
.tile:hover { border-color: var(--brass); box-shadow: 0 2px 10px rgba(91,26,44,.08); }
.tile-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--wine-tint); color: var(--wine); }
.tile-body { display: flex; flex-direction: column; gap: 2px; }
.tile-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem; color: var(--wine-dark); }
.tile-desc { font-size: .9rem; color: var(--muted); }

/* ---------- Mobile shell: top bar + drawer ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 18px 16px 56px; }
  h1 { font-size: 1.45rem; }

  .topbar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 8px;
    background: var(--wine); color: #fff;
  }
  .sidebar-toggle { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
  .sidebar-toggle:hover { background: rgba(255,255,255,.12); }
  .topbar-brand { display: flex; align-items: center; }
  .topbar-logo { display: block; height: 28px; width: auto; }

  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(84vw, 300px); height: auto;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(30,12,18,.5); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

@media print {
  .sidebar, .topbar, .sidebar-backdrop, .no-print, .skip-link { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
}
