/* Tidrapport — Blikk-inspirerad design: mörk sidomeny, ljus yta, kort. */
:root {
  --navy: #10243e;
  --navy-2: #16304f;
  --blue: #2f6fed;
  --blue-dark: #2258c4;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e3e8f0;
  --text: #1c2b3a;
  --muted: #6b7a8c;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 36, 62, .08), 0 4px 16px rgba(16, 36, 62, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }

/* ── Inloggning ─────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, #1d3a61 100%); padding: 20px;
}
.login-card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  padding: 36px 32px; width: 100%; max-width: 380px; text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { margin: 8px 0 4px; }
.login-card p { margin-bottom: 20px; }
.login-card label { display: block; text-align: left; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 12px 14px; font-size: 17px; border: 1.5px solid var(--border);
  border-radius: 10px; text-align: center; letter-spacing: 1px;
}
.login-card input:focus { outline: none; border-color: var(--blue); }
.fel { color: var(--red); font-size: 13px; margin-top: 12px; }

/* ── Layout ─────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--navy); color: #cfe0f4; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
.brand { font-size: 18px; font-weight: 700; color: #fff; padding: 20px 18px 14px; }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; }
#nav a {
  color: #b9cce4; text-decoration: none; padding: 11px 12px; border-radius: 10px;
  font-size: 14.5px; display: flex; gap: 10px; align-items: center;
}
#nav a:hover { background: var(--navy-2); color: #fff; }
#nav a.aktiv { background: var(--blue); color: #fff; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.me { font-size: 13px; color: #9fb4ce; margin-bottom: 8px; }
.main { flex: 1; padding: 26px 30px 90px; max-width: 1080px; }

/* ── Komponenter ────────────────────────────── */
.vy-huvud { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.vy-huvud .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card h2 { margin-bottom: 12px; }
.btn {
  border: 1.5px solid var(--border); background: #fff; color: var(--text); font-size: 14px;
  padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: #c6d2e2; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.gron { background: var(--green); border-color: var(--green); color: #fff; }
.btn.rod { background: #fff; border-color: #f3c1c1; color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text); max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.falt { display: flex; flex-direction: column; }
.rad { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.tabell-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.utkast { background: #eef2f7; color: var(--muted); }
.badge.inskickad { background: #fef3c7; color: #92400e; }
.badge.attesterad { background: #dcfce7; color: #166534; }
.badge.avvisad { background: #fee2e2; color: #991b1b; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow); font-size: 14px; z-index: 100; max-width: 90vw;
}
.toast.fel-toast { background: var(--red); }

/* ── Tidvy: veckogrid ───────────────────────── */
.vecka-nav { display: flex; align-items: center; gap: 10px; }
.vecka-nav .titel { font-weight: 700; min-width: 150px; text-align: center; }
.dag-kort { display: flex; flex-direction: column; gap: 10px; }
.dag {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 16px;
}
.dag.idag { border-color: var(--blue); }
.dag-huvud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dag-huvud .datum { font-weight: 700; }
.dag-huvud .summa { color: var(--muted); font-size: 13px; }
.tidrad-rad { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid #eef2f7; font-size: 14px; flex-wrap: wrap; }
.tidrad-rad .proj { font-weight: 600; }
.tidrad-rad .tim { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.vecka-fot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.vecka-fot .total { margin-right: auto; font-weight: 700; }

/* ── Resor ──────────────────────────────────── */
.resa-kort { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.resa-kort .belopp { font-size: 20px; font-weight: 800; white-space: nowrap; }
.berakning-ruta {
  background: #f0f5ff; border: 1px solid #d6e3fb; border-radius: 12px; padding: 14px 16px;
  font-size: 14px; margin-top: 14px;
}
.berakning-ruta .stor { font-size: 22px; font-weight: 800; color: var(--blue-dark); }
.berakning-ruta table td { padding: 3px 8px 3px 0; border: none; }

/* ── Månadsvy (kalender) ────────────────────── */
.kal-grid {
  display: grid; grid-template-columns: 34px repeat(7, 1fr); gap: 5px;
}
.kal-vnr { display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kal-rubrik { text-align: center; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 2px 0; text-transform: uppercase; letter-spacing: .4px; }
.kal-dag {
  border-radius: 10px; min-height: 62px; padding: 6px 7px; position: relative;
  border: 1px solid var(--border); background: #fff; font-size: 12px;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.kal-dag .nr { font-weight: 700; font-size: 13px; }
.kal-dag .tim { font-variant-numeric: tabular-nums; font-size: 11.5px; }
.kal-dag .bil { position: absolute; top: 5px; right: 6px; font-size: 13px; }
.kal-dag .etik { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.kal-dag.utanfor { opacity: .35; }
.kal-dag.idag { outline: 2px solid var(--navy); outline-offset: 1px; }

.kal-dag.arb { background: var(--blue); border-color: var(--blue); color: #fff; }
.kal-dag.arb .tim, .kal-dag.led-jobb .tim, .kal-dag.arb-over .tim { color: rgba(255,255,255,.9); }
.kal-dag.inbokad { background: #dbe7fd; border-color: #b9d0f8; color: #1d3a61; }
.kal-dag.led { background: #d9f2e3; border-color: #bde5cd; color: #14532d; }
.kal-dag.fra { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.kal-dag.arb-over {
  background: linear-gradient(135deg, var(--blue) 50%, var(--red) 50%);
  border-color: var(--blue); color: #fff;
}
.kal-dag.led-jobb {
  background: linear-gradient(135deg, #22b26a 50%, var(--red) 50%);
  border-color: #22b26a; color: #fff;
}
.kal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.kal-legend .prov { display: inline-block; width: 15px; height: 15px; border-radius: 5px;
  vertical-align: -3px; margin-right: 5px; border: 1px solid rgba(0,0,0,.08); }

@media (max-width: 760px) {
  .kal-grid { grid-template-columns: 22px repeat(7, 1fr); gap: 3px; }
  .kal-dag { min-height: 46px; padding: 3px 4px; }
  .kal-dag .tim { display: none; }
  .kal-dag .bil { font-size: 10px; top: auto; bottom: 3px; right: 4px; }
}

/* ── Statistik-rutor ────────────────────────── */
.stat-rad { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.stat .varde { font-size: 22px; font-weight: 800; }
.stat .namn { font-size: 12.5px; color: var(--muted); }

/* ── Mobil ──────────────────────────────────── */
.mobil-only { display: none !important; }
@media (max-width: 760px) {
  .mobil-only { display: flex !important; }
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: fixed; bottom: 0; top: auto; z-index: 50;
    flex-direction: row; align-items: center; padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .brand, .sidebar-foot { display: none; }
  #nav { flex-direction: row; overflow-x: auto; padding: 6px; gap: 2px; width: 100%; }
  #nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 7px 9px; flex-shrink: 0; }
  .main { padding: 16px 14px 110px; }
  .vy-huvud { flex-direction: column; align-items: stretch; }
  .vy-huvud .rad { width: 100%; }
  /* Formulär staplas vertikalt med fullbreddsfält — inget trängs eller försvinner */
  .rad { flex-direction: column; align-items: stretch; gap: 8px; }
  .rad .falt { width: 100%; }
  .rad input, .rad select { width: 100% !important; }
  .rad .btn { width: 100%; }
  .vecka-nav { width: 100%; justify-content: center; }
  .vecka-nav .btn { width: auto; }
  .card { padding: 14px; }
  .kal-dag .etik { display: none; }
}
