/* Hästen Service – tidrapportering. Mobil först. */

:root {
  --green-900: #1c2510;
  --green-800: #313b16;
  --green-700: #3f5220;
  --green-600: #52692c;
  --green-500: #6b8539;
  --green-200: #d4ddbd;
  --green-100: #e9eedb;
  --green-50:  #f3f6ea;
  --amber-600: #b7791f;
  --amber-100: #fbeed2;
  --red-600:   #b23b3b;
  --red-100:   #f8dcdc;
  --blue-600:  #2f5f9e;
  --blue-100:  #dbe7f6;
  --gray-900:  #1f2420;
  --gray-700:  #4a524b;
  --gray-500:  #7a837b;
  --gray-300:  #cfd5cf;
  --gray-200:  #e3e7e2;
  --gray-100:  #f0f2ee;

  --bg:        #f4f5f0;
  --surface:   #ffffff;
  --surface-2: #f7f8f3;
  --text:      var(--gray-900);
  --text-2:    var(--gray-700);
  --text-3:    var(--gray-500);
  --border:    var(--gray-200);
  --primary:   var(--green-700);
  --primary-hover: var(--green-600);
  --on-primary: #ffffff;
  --accent:    var(--amber-600);
  --danger:    var(--red-600);
  --shadow:    0 1px 2px rgba(20, 30, 10, .06), 0 4px 14px rgba(20, 30, 10, .06);
  --shadow-lg: 0 10px 40px rgba(20, 30, 10, .18);
  --radius:    14px;
  --radius-sm: 9px;
  --tab-h:     64px;
  --top-h:     56px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
  --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #121510;
    --surface:   #1b2017;
    --surface-2: #222a1d;
    --text:      #e8ebe2;
    --text-2:    #b9c0b2;
    --text-3:    #8a938a;
    --border:    #2e362a;
    --primary:   #6f8d3f;
    --primary-hover: #7fa04a;
    --green-100: #26311c;
    --green-50:  #1f2818;
    --green-200: #35452a;
    --amber-100: #3b2f14;
    --red-100:   #3d1f1f;
    --blue-100:  #1c2b40;
    --gray-100:  #222a1d;
    --gray-200:  #2e362a;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg:        #121510;
  --surface:   #1b2017;
  --surface-2: #222a1d;
  --text:      #e8ebe2;
  --text-2:    #b9c0b2;
  --text-3:    #8a938a;
  --border:    #2e362a;
  --primary:   #6f8d3f;
  --primary-hover: #7fa04a;
  --green-100: #26311c;
  --green-50:  #1f2818;
  --green-200: #35452a;
  --amber-100: #3b2f14;
  --red-100:   #3d1f1f;
  --blue-100:  #1c2b40;
  --gray-100:  #222a1d;
  --gray-200:  #2e362a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--text-3); }
.small { font-size: .875rem; }
.pre { white-space: pre-wrap; word-break: break-word; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: var(--green-800);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.topbar .title { font-weight: 600; font-size: 1.05rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { width: 40px; height: 40px; border: 0; background: transparent; color: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.topbar .back:hover { background: rgba(255,255,255,.12); }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 50%; background: #fff; }
.topbar .actions { display: flex; gap: 4px; }
.topbar .icon-btn { width: 40px; height: 40px; border: 0; background: transparent; color: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.12); }

.main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + var(--safe-b) + 24px); overflow-x: hidden; }
html { overflow-x: hidden; }
.main.wide { max-width: 1040px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--text-3); font-size: .7rem; font-weight: 500;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--primary); }
.tabbar a.primary-tab span.ico {
  width: 46px; height: 46px; margin-top: -22px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.tabbar a.primary-tab span.ico svg { width: 26px; height: 26px; }

.sidebar { display: none; }

@media (min-width: 900px) {
  .app { flex-direction: row; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    width: 240px; flex: 0 0 240px; position: sticky; top: 0; height: 100vh;
    padding: 20px 14px; background: var(--green-800); color: #fff;
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; padding: 6px 10px 18px; }
  .sidebar .brand img { width: 36px; height: 36px; border-radius: 50%; background: #fff; }
  .sidebar a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: rgba(255,255,255,.82); text-decoration: none; font-weight: 500; }
  .sidebar a svg { width: 22px; height: 22px; }
  .sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .sidebar a.active { background: rgba(255,255,255,.16); color: #fff; }
  .sidebar .spacer { flex: 1; }
  .sidebar .section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.5); padding: 14px 12px 4px; }
  .sidebar .user { padding: 10px 12px; font-size: .85rem; color: rgba(255,255,255,.7); border-top: 1px solid rgba(255,255,255,.12); margin-top: 8px; }
  .main { padding: 28px 32px 48px; flex: 1; }
  .page-title { display: block; }
}
.page-title { display: none; margin-bottom: 18px; }
@media (min-width: 900px) { .page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; } }

/* ---------- Komponenter ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card.tight { padding: 0; overflow: hidden; }
.card h2, .card h3 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2, .card-head h3 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .12s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red-100); color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.btn-row.right { justify-content: flex-end; }
.btn-row.right .btn { flex: 0 0 auto; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-weight: 500; font-size: .9rem; white-space: nowrap; cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--gray-300); }
.chip.active { background: var(--green-100); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip.sm { min-height: 30px; padding: 0 10px; font-size: .8rem; }

.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.segmented button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 7px; color: var(--text-2); font-weight: 600; }
.segmented button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.field { display: block; margin-bottom: 14px; }
.field > span.label, label.label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--text-3); margin-top: 4px; }
.field .err { font-size: .8rem; color: var(--danger); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(63, 82, 32, .15); }
.input.invalid { border-color: var(--danger); }
textarea.input { min-height: 90px; resize: vertical; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.stepper button { width: 52px; border: 0; background: var(--surface-2); font-size: 1.3rem; font-weight: 600; color: var(--primary); }
.stepper input { flex: 1; min-width: 0; border: 0; text-align: center; font-size: 1.25rem; font-weight: 600; background: transparent; min-height: 50px; outline: none; }
.checkbox { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--primary); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
.switch input { width: 44px; height: 24px; accent-color: var(--primary); }
.form-actions { margin-top: 18px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; background: var(--surface);
}
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); }
button.list-item { width: 100%; text-align: left; border: 0; cursor: pointer; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item .sub { font-size: .85rem; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .right { text-align: right; font-weight: 600; white-space: nowrap; }
.list-item .right .small { display: block; font-weight: 400; color: var(--text-3); }
.list-item .chev { color: var(--gray-300); font-size: 1.3rem; }
.list-item.selected { background: var(--green-50); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.badge-open { background: var(--green-100); color: var(--green-700); }
.badge-done { background: var(--blue-100); color: var(--blue-600); }
.badge-closed { background: var(--gray-100); color: var(--text-3); }
.badge-planned { background: var(--amber-100); color: var(--amber-600); }
.badge-removed { background: var(--red-100); color: var(--danger); }
.badge-neutral { background: var(--gray-100); color: var(--text-2); }
.badge-warn { background: var(--amber-100); color: var(--amber-600); }
.badge-ok { background: var(--green-100); color: var(--green-700); }
.badge-danger { background: var(--red-100); color: var(--danger); }
.badge-info { background: var(--blue-100); color: var(--blue-600); }
:root[data-theme="dark"] .badge-open, :root[data-theme="dark"] .badge-ok { color: #b7d386; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-open, :root:not([data-theme="light"]) .badge-ok { color: #b7d386; } }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 14px; }
.banner svg { flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px; }
.banner .body { flex: 1; }
.banner .body b { display: block; margin-bottom: 2px; }
.banner-warn { background: var(--amber-100); color: var(--amber-600); }
.banner-info { background: var(--blue-100); color: var(--blue-600); }
.banner-ok { background: var(--green-100); color: var(--green-700); }
.banner-danger { background: var(--red-100); color: var(--danger); }
.banner .btn { margin-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.stat .v { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: .75rem; color: var(--text-3); margin-top: 4px; }
@media (max-width: 380px) { .stats { gap: 6px; } .stat { padding: 10px; } .stat .v { font-size: 1.2rem; } }

.empty { text-align: center; padding: 34px 16px; color: var(--text-3); }
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: 8px; }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; }

.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--text-3); margin: 0; }
.kv dd { margin: 0; word-break: break-word; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--gray-100), var(--gray-200), var(--gray-100)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 16px; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 12px; background: var(--gray-900); color: #fff; box-shadow: var(--shadow-lg); font-size: .95rem; animation: toast-in .2s ease-out; display: flex; gap: 10px; align-items: center; }
.toast.ok { background: var(--green-700); }
.toast.err { background: var(--red-600); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Bottom sheet / dialog */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 8, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade-in .15s; }
@keyframes fade-in { from { opacity: 0; } }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; background: var(--surface); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: sheet-in .2s ease-out; padding-bottom: var(--safe-b); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } }
.sheet .grip { width: 42px; height: 5px; border-radius: 3px; background: var(--gray-300); margin: 10px auto 4px; }
.sheet .sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px 10px; }
.sheet .sheet-head h3 { flex: 1; margin: 0; }
.sheet .sheet-body { overflow-y: auto; padding: 4px 16px 16px; flex: 1; }
.sheet .sheet-foot { padding: 10px 16px 14px; border-top: 1px solid var(--border); }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 18px; max-height: 86vh; }
}

/* Kalender */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-nav h2 { margin: 0; font-size: 1.05rem; text-align: center; flex: 1; }
.cal-nav button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-size: 1.2rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 100%; overflow: hidden; }
.cal .dow { text-align: center; font-size: clamp(.55rem, 2.6vw, .7rem); color: var(--text-3); font-weight: 600; padding: 4px 0; min-width: 0; overflow: hidden; }
.cal .day {
  aspect-ratio: 1 / 1.05; border-radius: 10px; border: 1px solid transparent; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px; cursor: pointer; position: relative;
  min-width: 0; overflow: hidden; text-decoration: none; color: inherit;
}
.cal .day .n, .cal .day .h { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cal.week-strip { gap: 6px; }
.cal.week-strip .day { aspect-ratio: auto; padding: 8px 2px; }
.cal.week-strip .day .dow { font-size: .65rem; color: var(--text-3); }
@media (max-width: 400px) { .cal { gap: 3px; } .cal .day .h { font-size: .62rem; } .cal .day .n { font-size: .88rem; } .cal .day .h .unit { display: none; } }
.cal .day .n { font-weight: 600; font-size: clamp(.72rem, 3.4vw, .95rem); }
.cal .day .h { font-size: clamp(.5rem, 2.5vw, .68rem); color: var(--text-3); }
.cal .day.out { opacity: .32; background: transparent; cursor: default; }
.cal .day.worked { background: var(--green-100); border-color: var(--green-200); }
.cal .day.worked .h { color: var(--green-700); font-weight: 600; }
.cal .day.absence { background: var(--amber-100); }
.cal .day.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal .day.weekend .n { color: var(--text-3); }
.cal .day.selected { box-shadow: inset 0 0 0 2px var(--primary); }
.cal .day.future { background: var(--surface-2); }

/* Tabeller */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }

/* Inloggning */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, var(--green-800), var(--green-900)); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow-lg); }
.login-card .logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.login-card .logo img { width: 128px; height: 128px; }
.login-card .logo h1 { font-size: 1.3rem; }

/* Diverse */
.task-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.task-head h1 { font-size: 1.35rem; }
.task-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--text-3); font-size: .9rem; }
.attach { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.attach:last-child { border-bottom: 0; }
.attach .ico { width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; flex: 0 0 38px; }
.attach .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { position: relative; margin-bottom: 12px; }
.search input { padding-left: 40px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-3); }
.quick-dates { display: flex; gap: 8px; margin-top: 8px; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--amber-600); color: #fff; text-align: center; font-size: .85rem; padding: 4px; }
details.more > summary { cursor: pointer; color: var(--primary); font-weight: 600; list-style: none; padding: 8px 0; }
details.more > summary::-webkit-details-marker { display: none; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text); font-weight: 600; text-align: center; }
.menu-grid a svg { width: 28px; height: 28px; color: var(--primary); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--green-100); color: var(--green-700); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 40px; }
.day-list .list-item { padding-left: 0; padding-right: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.progress { height: 8px; border-radius: 4px; background: var(--gray-200); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); }

/* ---------- Admin ---------- */
.todo { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.card-head + .todo { border-top: 0; padding-top: 4px; }
.todo > svg { flex: 0 0 22px; margin-top: 2px; }
.todo.warn > svg { color: var(--amber-600); }
.todo.info > svg { color: var(--blue-600); }
.todo.ok > svg { color: var(--green-600); }
.todo .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo .body > span { color: var(--text-2); font-size: .92rem; }
.todo .act { margin-top: 8px; }
.admin-tiles a { align-items: flex-start; text-align: left; padding: 14px; gap: 6px; }
.admin-tiles a span { display: flex; flex-direction: column; }
.admin-tiles a small { font-weight: 400; color: var(--text-3); font-size: .78rem; line-height: 1.3; margin-top: 2px; }
@media (min-width: 700px) { .admin-tiles { grid-template-columns: repeat(3, 1fr); } }
.team { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(7, minmax(0, 1fr)); gap: 3px; width: 100%; }
.team .th { text-align: center; font-size: clamp(.55rem, 2.6vw, .72rem); color: var(--text-3); display: flex; flex-direction: column; line-height: 1.15; padding-bottom: 2px; }
.team .th b { color: var(--text); font-size: clamp(.7rem, 3.2vw, .9rem); }
.team .th.today b { color: var(--primary); }
.team .name { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 4px 4px 4px 0; text-decoration: none; color: var(--text); line-height: 1.15; }
.team .name .n { font-weight: 600; font-size: clamp(.75rem, 3.4vw, .95rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team .name .sum { font-size: clamp(.6rem, 2.7vw, .75rem); color: var(--text-3); }
.team .cell { display: flex; align-items: center; justify-content: center; min-height: 40px; min-width: 0; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); font-size: clamp(.62rem, 2.9vw, .82rem); font-weight: 600; color: var(--text-3); text-decoration: none; overflow: hidden; }
.team .cell.worked { background: var(--green-100); border-color: var(--green-200); color: var(--green-700); }
.team .cell.absence { background: var(--amber-100); color: var(--amber-600); border-color: transparent; }
.team .cell.missing { background: var(--red-100); color: var(--danger); border-color: transparent; }
.team .cell.future { opacity: .4; }
.team .cell.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.team-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; align-items: center; }
.team-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.team-legend i.worked { background: var(--green-200); }
.team-legend i.absence { background: var(--amber-100); border: 1px solid var(--amber-600); }
.team-legend i.missing { background: var(--red-100); border: 1px solid var(--danger); }
:root[data-theme="dark"] .team .cell.worked { color: #b7d386; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .team .cell.worked { color: #b7d386; } }

/* Kort hjälpruta överst på adminsidor */
.howto { background: var(--blue-100); color: var(--text); border-radius: var(--radius); padding: 0; margin-bottom: 14px; }
.howto summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--blue-600); list-style: none; display: flex; align-items: center; gap: 8px; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: '▾'; margin-left: auto; transition: transform .15s; }
.howto[open] summary::after { transform: rotate(180deg); }
.howto .in { padding: 0 16px 14px; font-size: .93rem; color: var(--text-2); }
.howto .in ol, .howto .in ul { margin: 0 0 8px; padding-left: 1.2em; }
.howto .in li { margin-bottom: 4px; }
:root[data-theme="dark"] .howto summary { color: #9dbbe6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .howto summary { color: #9dbbe6; } }

/* ---------- Instruktion ---------- */
.guide h2 { font-size: 1.15rem; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; }
.guide h2 .num { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; }
.guide .lead { color: var(--text-2); margin: 0 0 10px; }
.guide ol, .guide ul { padding-left: 1.3em; margin: 0 0 10px; }
.guide li { margin-bottom: 6px; }
.guide .tip { background: var(--green-50); border-left: 3px solid var(--green-600); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: .93rem; margin: 8px 0; }
.guide .toc { display: grid; grid-template-columns: 1fr; gap: 2px; }
@media (min-width: 600px) { .guide .toc { grid-template-columns: 1fr 1fr; } }
.guide .toc button { text-align: left; background: none; border: 0; padding: 8px 4px; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; }
.guide .toc button:hover { background: var(--surface-2); }
.flow { display: flex; flex-direction: column; gap: 0; margin: 6px 0 4px; }
.flow .step { display: flex; gap: 12px; align-items: flex-start; }
.flow .step .dot { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--green-100); color: var(--green-700); display: flex; align-items: center; justify-content: center; }
.flow .step .dot svg { width: 18px; height: 18px; }
.flow .step .txt { padding: 6px 0 14px; position: relative; }
.flow .step .txt b { display: block; }
.flow .step .txt span { color: var(--text-2); font-size: .92rem; }
.flow .step .who { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700; }

@media print {
  .sidebar, .tabbar, .topbar, .no-print, .toast-root { display: none !important; }
  body, .main { background: #fff !important; color: #000 !important; }
  .main { padding: 0 !important; margin: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc; break-inside: avoid; }
  .guide .page-title { display: block !important; }
}
