/* ==========================================================================
   Maatio Portal - brand styles
   Brand manual 2022: Montserrat; #23325F #4B5FE1 #E1FF69 #5082D7 #AACDD2 #735AE1 #F56E6E
   ========================================================================== */

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../vendor/fonts/montserrat-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../vendor/fonts/montserrat-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy:   #23325F;
  --blue:   #4B5FE1;
  --lime:   #E1FF69;
  --sky:    #5082D7;
  --mist:   #AACDD2;
  --violet: #735AE1;
  --coral:  #F56E6E;

  --bg: #1D2A52;             /* darkened navy backdrop */
  --card: #FFFFFF;
  --card-ink: #23325F;
  --ink-soft: #5B6684;
  --line: #E4E8F2;
  --sidebar-w: 250px;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(10, 18, 47, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--card-ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ==================== LOGIN ==================== */

.login-screen {
  position: fixed; inset: 0; z-index: 100;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(75, 95, 225, .55), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(115, 90, 225, .35), transparent 60%),
    var(--navy);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: 100%; max-width: 420px;
  padding: 42px 38px 30px;
  text-align: center;
}
.login-logo { width: 150px; margin-bottom: 18px; }
.login-card h1 { font-size: 20px; font-weight: 600; letter-spacing: .3px; margin-bottom: 8px; }
.login-sub { color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; margin-bottom: 26px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .6px; }
.login-card input {
  font: inherit; font-size: 15px;
  padding: 13px 14px;
  border: 1.5px solid var(--line); border-radius: 10px;
  outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--blue); }
#login-code { text-align: center; letter-spacing: 10px; font-size: 22px; font-weight: 600; }
.login-code-sent { font-size: 13px; color: var(--ink-soft); }
.login-demo-hint { margin-top: 22px; font-size: 12px; color: #9AA3BC; }

.btn-primary {
  font: inherit; font-weight: 600; font-size: 15px;
  background: var(--blue); color: #fff;
  border: 0; border-radius: 10px;
  padding: 13px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: #3D50CE; }
.btn-primary:active { transform: scale(.985); }
.btn-ghost {
  font: inherit; font-size: 13px; font-weight: 500;
  background: none; border: 0; color: var(--ink-soft);
  cursor: pointer; padding: 6px;
}
.btn-ghost:hover { color: var(--blue); }

/* ==================== LAYOUT ==================== */

.portal { display: block; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: var(--sidebar-w);
  background: var(--blue);
  display: flex; flex-direction: column;
  padding: 30px 0 22px;
  overflow-y: auto;
}
.sidebar-logo {
  width: 128px; margin: 0 26px 34px;
  filter: brightness(0) invert(1);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  color: #fff; text-decoration: none;
  font-size: 14.5px; font-weight: 500;
  padding: 11px 26px;
  border-left: 4px solid transparent;
  transition: background .12s;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, .10); }
.sidebar-nav a.active {
  background: rgba(255, 255, 255, .14);
  border-left-color: var(--lime);
  font-weight: 600;
}
.sidebar-bottom { margin-top: auto; padding: 24px 26px 0; display: flex; flex-direction: column; gap: 14px; }
.link-plain {
  font: inherit; font-size: 13px; font-weight: 500;
  background: none; border: 0; color: rgba(255, 255, 255, .85);
  cursor: pointer; text-align: left; padding: 0;
}
.link-plain:hover { color: #fff; text-decoration: underline; }
.link-logout { color: rgba(255, 255, 255, .6); }
.btn-contact {
  display: block; text-align: center; text-decoration: none;
  background: #fff; color: var(--navy);
  font-weight: 600; font-size: 14px;
  border-radius: 30px; padding: 11px 18px;
  transition: transform .12s;
}
.btn-contact:hover { transform: translateY(-1px); }
.demo-switcher { border-top: 1px solid rgba(255, 255, 255, .25); padding-top: 14px; }
.demo-switcher label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: rgba(255, 255, 255, .65); margin-bottom: 6px; }
.demo-switcher select {
  width: 100%; font: inherit; font-size: 13px;
  padding: 8px 10px; border-radius: 8px; border: 0;
  background: rgba(255, 255, 255, .92); color: var(--navy);
}

.sidebar-overlay { display: none; }

.mobile-topbar { display: none; }

.main {
  margin-left: var(--sidebar-w);
  padding: 30px 38px 26px;
  max-width: 1240px;
}

/* ==================== HEADER ==================== */

.client-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 26px;
}
.client-id { display: flex; align-items: center; gap: 14px; }
.client-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #fff; color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: .5px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .3);
}
.client-name { color: #fff; font-size: 19px; font-weight: 600; }
.client-services { color: var(--mist); font-size: 12.5px; margin-top: 2px; }
.header-controls { display: flex; gap: 10px; align-items: center; }
.header-controls select {
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 10px 14px; border-radius: 10px; border: 0;
  background: #fff; color: var(--navy); cursor: pointer;
}
.btn-outline {
  font: inherit; font-size: 13.5px; font-weight: 600;
  background: transparent; color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .55); border-radius: 10px;
  padding: 10px 16px; cursor: pointer;
  transition: background .12s;
}
.btn-outline:hover { background: rgba(255, 255, 255, .12); }

/* ==================== SECTIONS / CARDS ==================== */

.view-title { color: #fff; font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.view-sub { color: var(--mist); font-size: 13.5px; margin-bottom: 22px; }

.section-label {
  color: #fff; font-size: 15px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  margin: 30px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, .18); }
.section-label .chip { text-transform: none; letter-spacing: 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h3 { font-size: 14px; font-weight: 600; color: var(--card-ink); margin-bottom: 14px; }
.card .card-note { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--navy); color: #fff;
  border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi.lime { background: var(--lime); color: var(--navy); }
.kpi .kpi-label { font-size: 11px; font-weight: 500; opacity: .78; text-transform: uppercase; letter-spacing: .5px; }
.kpi .kpi-value { font-size: 21px; font-weight: 700; margin-top: 4px; white-space: nowrap; }
.kpi .kpi-delta { font-size: 11.5px; margin-top: 4px; font-weight: 600; }
.kpi .kpi-delta.up { color: #7BE38B; }
.kpi .kpi-delta.down { color: #FF9C9C; }
.kpi.lime .kpi-delta.up { color: #1E7C33; }
.kpi.lime .kpi-delta.down { color: #C0392B; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; }

.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 330px; }
.chart-wrap.short { height: 220px; }

/* ==================== TABLES ==================== */

.table-scroll { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-soft);
  background: #F3F5FA;
  padding: 9px 12px;
  white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.data th.sorted-asc::after { content: ' ▲'; font-size: 9px; }
table.data th.sorted-desc::after { content: ' ▼'; font-size: 9px; }
table.data th.no-sort { cursor: default; }
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #F8F9FD; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); }
.table-foot .pager { display: flex; gap: 6px; }
.table-foot button {
  font: inherit; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 7px; padding: 5px 11px; cursor: pointer;
}
.table-foot button:disabled { opacity: .4; cursor: default; }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row input, .filter-row select {
  font: inherit; font-size: 13px;
  padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 9px;
  outline: none; background: #fff; color: var(--navy);
}
.filter-row input:focus, .filter-row select:focus { border-color: var(--blue); }
.filter-row input[type="search"] { min-width: 220px; flex: 1; }

/* chips & badges */
.chip {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  border-radius: 20px; padding: 3px 10px;
  white-space: nowrap;
}
.chip.fb { background: #E7EDFB; color: #3D5A98; }
.chip.ig { background: #FCE9F1; color: #C13584; }
.chip.li { background: #E3F0F8; color: #0A66C2; }
.chip.tt { background: #E9E9EB; color: #161823; }
.chip.gads { background: #FDF3E3; color: #B06F00; }
.chip.web { background: #E8F3EC; color: #1E7C43; }
.chip.lime { background: var(--lime); color: var(--navy); }
.chip.grey { background: #EEF0F6; color: var(--ink-soft); }

.quality-dots { display: inline-flex; gap: 2.5px; }
.quality-dots i { width: 7px; height: 7px; border-radius: 50%; background: #E0E4EE; }
.quality-dots i.on { background: var(--blue); }

/* ==================== FEED ==================== */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.feed-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  position: relative;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.feed-card:hover { transform: translateY(-3px); }
.feed-card img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; }
.feed-card .feed-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .82));
  color: #fff; padding: 34px 14px 12px;
  font-size: 12px; line-height: 1.5;
}
.feed-card .feed-meta strong {
  font-size: 13.5px; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-card .feed-meta .copy-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11.5px; line-height: 1.45; opacity: .88;
  margin: 2px 0 4px;
}
.feed-back {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: #fff; background: none; border: 0; cursor: pointer;
  margin-bottom: 16px; padding: 0;
}
.feed-back:hover { text-decoration: underline; }

.post-detail-head { display: flex; gap: 20px; align-items: flex-start; }
.post-detail-head img {
  width: 260px; border-radius: 12px; flex-shrink: 0;
  aspect-ratio: 1 / 1; object-fit: cover;
}
.post-copy { font-size: 13.5px; line-height: 1.65; color: var(--card-ink); white-space: pre-line; }
.post-copy .hashtags { color: var(--blue); }

.seg {
  display: inline-flex; border-radius: 10px; overflow: hidden; flex-wrap: wrap;
  border: 1.5px solid rgba(255, 255, 255, .4); margin-bottom: 16px;
}
.view-sub + .seg { margin-top: -6px; }
.seg button {
  font: inherit; font-size: 13px; font-weight: 600;
  border: 0; padding: 8px 18px; cursor: pointer;
  background: transparent; color: #fff;
}
.seg button.on { background: #fff; color: var(--navy); }
.seg.dark { border-color: var(--line); }
.seg.dark button { color: var(--ink-soft); }
.seg.dark button.on { background: var(--navy); color: #fff; }

/* ==================== AI / PLAN ==================== */

.ai-card { border-left: 5px solid var(--violet); }
.ai-card.pos { border-left-color: #35B45F; }
.ai-card.warn { border-left-color: var(--coral); }
.ai-card .ai-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-soft); }
.ai-card p { font-size: 13.5px; line-height: 1.6; margin-top: 8px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.plan-card h4 { font-size: 15px; margin-bottom: 4px; }
.plan-card .plan-price { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 12px; }
.plan-card ul { list-style: none; }
.plan-card li { font-size: 13px; padding: 6px 0 6px 22px; position: relative; border-bottom: 1px dashed var(--line); }
.plan-card li:last-child { border-bottom: 0; }
.plan-card li::before {
  content: '✓'; position: absolute; left: 0; top: 6px;
  color: var(--blue); font-weight: 700;
}
.upcoming-item { display: flex; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.upcoming-item:last-child { border-bottom: 0; }
.upcoming-date {
  background: var(--navy); color: #fff; border-radius: 10px;
  min-width: 56px; text-align: center; padding: 7px 4px;
}
.upcoming-date b { display: block; font-size: 17px; }
.upcoming-date span { font-size: 10px; text-transform: uppercase; }
.upcoming-item .u-title { font-size: 13.5px; font-weight: 600; }
.upcoming-item .u-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.locked-view { text-align: center; padding: 60px 30px; }
.locked-view .lock-ico { font-size: 40px; }
.locked-view h3 { margin: 14px 0 8px; font-size: 17px; }
.locked-view p { color: var(--ink-soft); font-size: 13.5px; max-width: 430px; margin: 0 auto 20px; line-height: 1.6; }

/* ==================== GEO-OPTIMOINTI ==================== */

.chip.ai-engine { background: #EFEAFB; color: var(--violet); }
.geo-score {
  display: inline-block; min-width: 38px; text-align: center;
  font-weight: 700; font-size: 12.5px;
  border-radius: 8px; padding: 3px 8px;
}
.geo-score.good { background: #E4F6E9; color: #1E7C33; }
.geo-score.mid { background: #FDF3E3; color: #B06F00; }
.geo-score.low { background: #FBE7E7; color: #C0392B; }
.geo-score.none { background: #EEF0F6; color: var(--ink-soft); }

.geo-domain {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.geo-domain:last-of-type { border-bottom: 0; }
.geo-domain.own .gd-name { font-weight: 700; }
.geo-domain .gd-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-domain .gd-engines { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }

.geo-fact {
  border: 1px solid var(--line); border-left: 4px solid var(--mist);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.geo-fact.own { border-left-color: var(--lime); background: #FDFFF0; }
.geo-fact .gf-text { font-size: 13.5px; line-height: 1.55; }
.geo-fact .gf-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px; font-size: 11.5px; color: var(--ink-soft);
}
.geo-fact .gf-src { display: inline-flex; align-items: center; gap: 5px; }
.geo-own-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--card-ink); cursor: pointer;
  padding: 9px 0;
}

/* ==================== YRITYSLIIDIT (Leadfeeder-style) ==================== */

.lf-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.lf-insights { display: flex; flex-direction: column; gap: 14px; }
.lf-insights .card { margin-bottom: 0; }

.lf-feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.lf-feed-head h3 { margin-bottom: 0; }
.lf-feed-head input {
  font: inherit; font-size: 13px; padding: 8px 12px;
  border: 1.5px solid var(--line); border-radius: 9px; outline: none;
  min-width: 180px;
}
.lf-feed-head input:focus { border-color: var(--blue); }

.lf-item { border-bottom: 1px solid var(--line); }
.lf-item:last-child { border-bottom: 0; }
.lf-item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; cursor: pointer;
}
.lf-item-row:hover { background: #F8F9FD; }
.lf-logo {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
  object-fit: contain; background: #fff; border: 1px solid var(--line);
}
.lf-logo-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: var(--lime);
  font-weight: 700; font-size: 16px; border: 0;
}
.lf-item-main { min-width: 0; flex: 1; }
.lf-item-main strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-item-meta { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.lf-item-side { text-align: right; flex-shrink: 0; }
.lf-ago { display: block; font-size: 11.5px; color: var(--ink-soft); }
.lf-visits { display: block; font-size: 12px; font-weight: 600; margin-top: 2px; }

.lf-detail { padding: 4px 8px 14px 56px; }
.lf-d-head { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; }
.lf-d-head a { color: var(--blue); }
.lf-visit { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.lf-visit-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.lf-visit-len { color: var(--ink-soft); font-size: 12px; }
.lf-page {
  font-size: 12px; color: var(--card-ink); padding: 3px 0 3px 12px;
  border-left: 2px solid var(--mist); margin-top: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lf-page span { color: var(--ink-soft); }

.lf-nums { display: flex; gap: 24px; }
.lf-num { font-size: 26px; font-weight: 700; }
.lf-num-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin-top: 2px; }

.lf-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.lf-row-name { flex: 0 0 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-bar { flex: 1; height: 14px; background: #EEF0F6; border-radius: 7px; overflow: hidden; }
.lf-bar span { display: block; height: 100%; background: var(--lime); border-radius: 7px; min-width: 3px; }
.lf-row-pct { flex: 0 0 38px; text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .lf-wrap { grid-template-columns: 1fr; }
}

/* ==================== MODAL & TOAST ==================== */

.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(16, 24, 52, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-box {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 760px; max-height: 84vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px 14px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 18px; }
.modal-close {
  font-size: 26px; line-height: 1; background: none; border: 0;
  cursor: pointer; color: var(--ink-soft); padding: 0 4px;
}
.modal-body { padding: 20px 26px 26px; overflow-y: auto; }
.glossary-group h4 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--blue); margin: 18px 0 8px;
}
.glossary-group:first-child h4 { margin-top: 0; }
.glossary-group dt { font-weight: 600; font-size: 13.5px; margin-top: 10px; }
.glossary-group dd { font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin-top: 2px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff;
  font-size: 13.5px; font-weight: 500;
  border-radius: 30px; padding: 12px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  z-index: 95; max-width: 90vw; text-align: center;
}

.portal-footer {
  margin-top: 40px; padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .15);
  display: flex; align-items: center; gap: 12px;
  color: rgba(255, 255, 255, .55); font-size: 11.5px;
}
.portal-footer img { width: 66px; filter: brightness(0) invert(1); opacity: .55; }

/* ==================== AUTH / SESSION / TELEPORT ==================== */

.login-error {
  margin-top: 16px;
  background: #FDEBEB; color: #B03030;
  border: 1px solid #F5C4C4; border-radius: 9px;
  font-size: 13px; font-weight: 500;
  padding: 11px 14px; text-align: left;
}
.login-card button:disabled { opacity: .55; cursor: wait; }

.session-box {
  border-top: 1px solid rgba(255, 255, 255, .25);
  padding-top: 12px;
}
.session-user { color: #fff; font-size: 12.5px; font-weight: 600; word-break: break-all; }
.session-timer { color: rgba(255, 255, 255, .6); font-size: 11px; margin-top: 3px; }

.teleport-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--lime); color: var(--navy);
  border-radius: 12px; padding: 12px 18px;
  font-size: 13.5px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.teleport-banner button {
  font: inherit; font-size: 12.5px; font-weight: 700;
  background: var(--navy); color: #fff;
  border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  white-space: nowrap;
}
.teleport-banner button:hover { background: #17224A; }

/* ==================== ADMIN (Hallinta) ==================== */

.admin-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; align-items: end;
}
.admin-form .field { display: flex; flex-direction: column; gap: 4px; }
.admin-form label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.admin-form input, .admin-form select {
  font: inherit; font-size: 13px;
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 8px;
  outline: none; background: #fff; color: var(--navy); min-width: 0;
}
.admin-form input:focus, .admin-form select:focus { border-color: var(--blue); }
.admin-form .btn-primary { padding: 10px 16px; font-size: 13.5px; }

.admin-client-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.admin-client-head h3 { margin-bottom: 2px; font-size: 15px; }
.admin-client-head .meta { font-size: 12px; color: var(--ink-soft); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-small {
  font: inherit; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 8px; padding: 7px 12px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.btn-small:hover { border-color: var(--blue); }
.btn-small.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-small.primary:hover { background: #3D50CE; }
.btn-small.danger { color: #B03030; }
.btn-small.danger:hover { border-color: #B03030; }
.btn-small.teleport { background: var(--lime); border-color: var(--lime); color: var(--navy); }
.btn-small:disabled { opacity: .5; cursor: default; }

.chip.inactive { background: #F3E3E3; color: #B03030; }
.chip.role-admin { background: #EEE8FC; color: var(--violet); }

.ds-section {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.ds-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ds-head h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-soft); }
.ds-status { margin-top: 10px; font-size: 12.5px; }
.ds-status .ds-detail { color: var(--ink-soft); margin-left: 6px; }

.not-connected { text-align: center; padding: 54px 30px; }
.not-connected .nc-ico { font-size: 36px; }
.not-connected h3 { margin: 12px 0 8px; font-size: 16px; }
.not-connected p { color: var(--ink-soft); font-size: 13.5px; max-width: 460px; margin: 0 auto; line-height: 1.6; }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 980px) {
  .grid-2, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .post-detail-head { flex-direction: column; }
  .post-detail-head img { width: 100%; max-width: 340px; }
}

@media (max-width: 820px) {
  .mobile-topbar {
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 60;
    background: var(--blue); padding: 12px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
  }
  .menu-toggle {
    width: 38px; height: 34px; border: 0; background: none; cursor: pointer;
    display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 6px;
  }
  .menu-toggle span { height: 2.5px; background: #fff; border-radius: 2px; }
  .mobile-logo { width: 96px; filter: brightness(0) invert(1); }

  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 270px; z-index: 70; padding-top: 22px; }
  .sidebar-logo { width: 104px; margin-bottom: 24px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(10, 16, 38, .55);
  }
  .main { margin-left: 0; padding: 20px 16px; }
  .client-header { flex-direction: column; align-items: flex-start; }
  .header-controls { width: 100%; }
  .header-controls select { flex: 1; }
  .chart-wrap { height: 240px; }
  .kpi .kpi-value { font-size: 18px; }
}
