/* Hallinta: hillitty, tiivis työkalutyyli. Yksi korostusväri (--primary), vaalea teema. */
.admin { --accent-soft: rgb(28 138 116 / .1); font-size: 15px; line-height: 1.5; }
.admin header, .admin main { max-width: 1040px; }
.admin h1 { font-size: 20px; line-height: 1.3; margin: 0; font-weight: 650; }
.admin h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
.admin h3 { font-size: 15px; }
.admin .card, .admin .panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 14px 0; }
.admin .panel.flush { padding: 0; overflow: hidden; }
.admin button, .admin .btn { width: auto; margin-top: 0; padding: 8px 14px; font-size: 14px; border-radius: 8px; }
.admin button.block { width: 100%; margin-top: 18px; padding: 12px; font-size: 16px; }
.admin button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.admin button.ghost:hover { background: var(--bg); }
.admin button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); font-weight: 500; }
.admin button.small { padding: 5px 10px; font-size: 13px; }
.admin select, .admin input { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.admin input[type=checkbox] { width: auto; }
.admin label { font-size: 13px; font-weight: 600; margin: 0 0 4px; color: var(--muted); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--primary); border-color: rgb(28 138 116 / .4); background: var(--accent-soft); }
.badge.wait { color: #8a5a00; border-color: #e0c27a; background: #fbf4e2; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-form > div { flex: 1 1 200px; }
.row-form button { height: 38px; }
.table-wrap { overflow-x: auto; }
td.actions { text-align: right; white-space: nowrap; }
code { background: var(--bg); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; font-size: 13px; word-break: break-all; }
.note { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px; color: var(--muted); }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; max-width: 90vw; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 100; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--primary); color: var(--primary-text); }
.danger-zone { border-color: var(--danger); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field label { margin: 0; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr 90px; gap: 12px; align-items: center; padding: 4px 0; }
.bar-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 2px; height: 8px; overflow: hidden; }
.bar { background: var(--primary); height: 100%; }
.bar-value { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Sovelluskehys: kiinteä sivuvalikko */
.in-app > header { display: none; }
.in-app main#app { max-width: none; padding: 0; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 16px; padding: 18px 12px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.side-logout-mobile { display: none; }
.side-org { padding: 0 8px; }
.side-org label { font-size: 12px; font-weight: 600; }
.side-org select { width: 100%; }
.side-name { font-weight: 650; line-height: 1.3; }
.side-role { color: var(--muted); font-size: 13px; margin-top: 2px; }
.side-nav { display: flex; flex-wrap: nowrap; flex-direction: column; gap: 1px; flex: 1; }
.nav-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }
.admin .nav-item { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); border: 0; border-left: 3px solid transparent; border-radius: 0 6px 6px 0; padding: 8px 10px; font-size: 14px; font-weight: 500; }
.admin .nav-item:hover { background: var(--bg); }
.admin .nav-item[aria-current=page] { background: var(--accent-soft); border-left-color: var(--primary); color: var(--text); font-weight: 650; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 8px 0; display: flex; flex-direction: column; gap: 8px; }
.side-email { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 4px 28px 48px; min-width: 0; }
.content { max-width: 980px; }
.page-head { margin: 22px 0 2px; }
.page-head p { margin: 2px 0 0; }
.crumbs { margin-top: 16px; }
.crumbs + .page-head { margin-top: 10px; }

/* Taulukot: tiheät, otsikkorivi pieni */
.empty { color: var(--muted); padding: 16px; margin: 0; font-size: 14px; }
table.data { font-size: 14px; }
table.data thead th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--bg); border-bottom: 1px solid var(--line); }
table.data td, table.data th { padding: 9px 12px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: var(--bg); }
.panel:not(.flush) table.data thead th { background: transparent; padding-left: 6px; }
.panel:not(.flush) table.data td { padding-left: 6px; }
table.reports td { padding: 12px 14px; vertical-align: middle; }
table.reports td .muted { margin-top: 1px; }
.triplines div { line-height: 1.4; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.weeknav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Yleiskatsaus */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
ul.todo { list-style: none; margin: 0; padding: 0; }
ul.todo li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0 9px 12px; border-left: 3px solid #d9a21b; margin: 0 0 6px; background: #fbf8ef; border-radius: 0 6px 6px 0; padding-right: 10px; }
ul.todo .muted { font-size: 13px; }
ol.steps { margin: 12px 0 0; padding-left: 20px; }
ol.steps li { color: var(--muted); font-size: 14px; }

/* Mobiili: valikko ylös, taulukon rivit korteiksi */
@media (max-width: 860px) {
  .shell { display: block; }
  .side { position: static; height: auto; overflow: visible; gap: 10px; padding: 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-top, .side-org { padding: 0; }
  .side-logout-mobile { display: inline-block; }
  .side-foot { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; margin: 0 -16px; padding: 0 16px; flex: none; }
  .nav-group { display: none; }
  .admin .nav-item { flex: none; width: auto; white-space: nowrap; border-left: 0; border-radius: 0; border-bottom: 3px solid transparent; padding: 10px 12px; }
  .admin .nav-item[aria-current=page] { background: transparent; border-bottom-color: var(--primary); }
  .main { padding: 0 16px 40px; }
  .period > div, .row-form > div { flex: 1 1 130px !important; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border-bottom: 1px solid var(--line); padding: 6px 12px; }
  table.data tr:last-child { border-bottom: 0; }
  table.data td { display: flex; justify-content: space-between; gap: 12px; border-bottom: 0; padding: 4px 0 !important; text-align: right; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: none; }
  table.data td:not([data-label])::before { content: none; }
  table.reports td { display: block; text-align: left; }
  table.reports td.actions { text-align: left; padding-top: 6px !important; }
  td.actions { justify-content: flex-end; white-space: normal; flex-wrap: wrap; }
  .toolbar > button { width: 100%; }
}

/* Kirjautuminen */
.login-wrap { min-height: calc(100vh - 140px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 0; }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 32px 28px; box-shadow: 0 1px 2px rgb(0 0 0 / .04), 0 12px 32px rgb(0 0 0 / .06); display: flex; flex-direction: column; gap: 6px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; margin-bottom: 14px; }
.login-brand .logo-mark { width: 28px; height: 28px; }
.login-brand .logo-word { height: 15px; margin-right: 0; }
.login-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.login-switch a, .login-switch span { padding: 9px 8px; text-align: center; font-size: 14px; font-weight: 600; border-radius: 7px; color: var(--muted); text-decoration: none; }
.login-switch a:hover { color: var(--text); }
.login-switch .active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.login-card h1 { font-size: 24px; margin: 0; }
.login-card .muted { margin: 4px 0 14px; font-size: 14px; }
.login-card input { width: 100%; padding: 11px 12px; }
.login-card input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.login-card label { margin-top: 8px; }
.login-card button.block { margin-top: 16px; padding: 12px; }
.pw-field { position: relative; display: flex; }
.pw-field input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: transparent; color: var(--muted); border: 0; font-size: 13px; font-weight: 600; padding: 6px 10px; cursor: pointer; }
.pw-toggle:hover { color: var(--text); }
.login-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.login-foot a { font-size: 14px; font-weight: 600; }
button.link { background: transparent; border: 0; color: var(--primary); font-size: 14px; font-weight: 600; padding: 6px 8px; cursor: pointer; }
button.link:hover { text-decoration: underline; }
.msg.ok { color: var(--primary); background: var(--accent-soft); border: 1px solid rgb(28 138 116 / .3); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.login-note { max-width: 400px; text-align: center; font-size: 13px; margin: 0; }
