/* ==================================================================
   Työhuone – vaalea korttiteema
   ================================================================== */

:root {
  --ink:        #1E2533;
  --ink-soft:   #63708A;
  --ink-faint:  #94A0B4;
  --line:       #E7EAF1;
  --card:       #FFFFFF;
  --list-bg:    rgba(255, 255, 255, 0.66);

  --blue:   #3D7BFF;
  --pink:   #FF5E8A;
  --amber:  #F5A524;
  --green:  #12B886;
  --violet: #8A6BFF;
  --orange: #FF7A45;
  --teal:   #0FA9A9;
  --rose:   #E1568C;

  --danger: #E5484D;
  --warn:   #E8930C;
  --ok:     #12B886;

  --radius:    16px;
  --radius-s:  11px;

  --shadow-1: 0 1px 2px rgba(20, 30, 60, .07), 0 2px 6px rgba(20, 30, 60, .06);
  --shadow-2: 0 6px 16px rgba(20, 30, 60, .14);
  --shadow-3: 0 18px 40px rgba(20, 30, 60, .24);

  --sans:    "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;

  color-scheme: light;
}

[data-color="blue"]   { --who: var(--blue); }
[data-color="pink"]   { --who: var(--pink); }
[data-color="amber"]  { --who: var(--amber); }
[data-color="green"]  { --who: var(--green); }
[data-color="violet"] { --who: var(--violet); }
[data-color="orange"] { --who: var(--orange); }
[data-color="teal"]   { --who: var(--teal); }
[data-color="rose"]   { --who: var(--rose); }

/* Taustavaihtoehdot */
body[data-bg="sky"]    { --bg: linear-gradient(165deg, #8ED0FF 0%, #4A87F0 100%); }
body[data-bg="mint"]   { --bg: linear-gradient(165deg, #A8EED6 0%, #34B79A 100%); }
body[data-bg="peach"]  { --bg: linear-gradient(165deg, #FFD3A8 0%, #FF8A6B 100%); }
body[data-bg="lilac"]  { --bg: linear-gradient(165deg, #D6C7FF 0%, #8C7BF0 100%); }
body[data-bg="sun"]    { --bg: linear-gradient(165deg, #FFE39B 0%, #FFB03A 100%); }
body[data-bg="rose"]   { --bg: linear-gradient(165deg, #FFC3D6 0%, #F5789F 100%); }
body[data-bg="sea"]    { --bg: linear-gradient(165deg, #9BE7E0 0%, #2C93A8 100%); }
body[data-bg="forest"] { --bg: linear-gradient(165deg, #B6E3A8 0%, #3E9D6B 100%); }
body[data-bg="paper"]  { --bg: linear-gradient(165deg, #F6F3EC 0%, #DFD8CB 100%); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

/* Tausta omalle kerrokselle: pysyy paikallaan vieritettäessä ilman
   iOS:n background-attachment-ongelmia. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--bg, linear-gradient(165deg, #8ED0FF, #4A87F0));
  z-index: -1;
}

body.is-locked { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 600; }

button {
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

input { font-family: inherit; font-size: 16px; color: var(--ink); }

:focus-visible { outline: 3px solid rgba(61, 123, 255, .45); outline-offset: 2px; border-radius: 8px; }

/* --- Yläpalkki ----------------------------------------------------- */

.topbar { padding-top: calc(env(safe-area-inset-top) + 12px); }

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

@media (min-width: 1180px) { .topbar-inner, .filters { max-width: 1500px; } }

.brand { min-width: 0; }
.brand h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.today {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .8);
}

.brand h1 {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(20, 30, 60, .18);
}

.top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }

.next-strip {
  max-width: 1180px;
  margin: 10px auto 0;
  padding: 0 16px;
  display: flex;
  justify-content: flex-start;
}

@media (min-width: 1180px) { .next-strip { max-width: 1500px; } }

.next-up {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-1);
}
.next-up i {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
.next-up b { font-size: 12.5px; font-weight: 700; color: var(--nu, var(--ink)); white-space: nowrap; }
.next-up span {
  font-size: 12.5px;
  min-width: 0;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .3);
  color: #fff;
  text-decoration: none;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .5); }
.icon-btn svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#openSettings svg { stroke-width: 1.5; }

.filters {
  max-width: 1180px;
  margin: 12px auto 0;
  padding: 0 16px 2px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 13px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .38);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--who, #fff); }
.chip[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

.netbar {
  margin: 12px 16px 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-1);
}

/* --- Listat --------------------------------------------------------- */

.board {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
  align-items: start;
}

.board > * { min-width: 0; }

@media (min-width: 860px) {
  .board { grid-template-columns: 1fr 1fr; gap: 20px; padding-top: 20px; }
}

@media (min-width: 1180px) {
  .board {
    max-width: 1500px;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 22px;
  }
}

.list {
  min-width: 0;
  background: var(--list-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-1);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.list-head h2 { font-family: var(--display); font-size: 19px; font-weight: 600; }

.list-head-right { display: flex; align-items: center; gap: 10px; }

.count { font-size: 12px; font-weight: 600; color: var(--ink-faint); }

.mini-btn {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  min-height: 32px;
  padding: 0 13px;
  box-shadow: var(--shadow-1);
}
.mini-btn:hover { color: var(--ink); }
.mini-btn--danger { color: var(--danger); margin-top: 10px; }

.empty { margin: 14px 4px; color: var(--ink-soft); font-size: 14px; }

/* --- Lisäyslomake --------------------------------------------------- */

.composer {
  background: var(--card);
  border-radius: var(--radius-s);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-1);
}

.composer-title, .composer-note {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  font-weight: 600;
}
.composer-note { font-weight: 500; color: var(--ink-soft); }
.composer-title::placeholder, .composer-note::placeholder { color: var(--ink-faint); font-weight: 500; }
.composer-title:focus, .composer-note:focus { outline: none; }

.composer .who { margin: 10px 0 2px; }

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.who { display: flex; gap: 7px; flex-wrap: wrap; }

.who-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px 0 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.who-btn[aria-checked="true"] {
  border-color: var(--who);
  background: color-mix(in srgb, var(--who) 12%, #fff);
  color: var(--ink);
}
.who-btn .avatar { width: 26px; height: 26px; font-size: 11px; }

.date-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.date-btn:hover { border-color: var(--ink-faint); }
.date-btn.has-date { color: var(--ink); border-color: var(--blue); background: rgba(61, 123, 255, .07); }
.date-btn--block { width: 100%; }

.btn-primary {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  min-height: 40px;
  padding: 0 20px;
  transition: transform .12s, box-shadow .15s;
  box-shadow: var(--shadow-1);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn-primary:disabled { opacity: .5; transform: none; }

.btn-ghost {
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  padding: 0 16px;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-faint); }

.btn-danger {
  border: 0;
  border-radius: 999px;
  background: rgba(229, 72, 77, .1);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  padding: 0 16px;
  margin-right: auto;
}

/* --- Kortit ---------------------------------------------------------- */

.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  background: var(--card);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-1);
  transition: box-shadow .15s, transform .12s;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--who, var(--line));
}
.card:hover { box-shadow: var(--shadow-2); }

.card.is-dragging {
  position: fixed;
  z-index: 70;
  margin: 0;
  transform: rotate(2.5deg) scale(1.02);
  box-shadow: var(--shadow-3);
  pointer-events: none;
  cursor: grabbing;
}

.card-placeholder {
  border-radius: var(--radius-s);
  border: 2px dashed rgba(30, 37, 51, .18);
  background: rgba(255, 255, 255, .35);
}

.check {
  position: relative;
  flex: 0 0 auto;
  margin-top: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink-faint);
  background: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background .15s, border-color .15s;
}
.check::before { content: ""; position: absolute; inset: -11px; }
.check::after {
  content: "";
  width: 10px; height: 5.5px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) scale(.4);
  opacity: 0;
  transition: transform .15s, opacity .15s;
  margin-top: -2px;
}
.check:hover { border-color: var(--who, var(--ink)); }
.check[aria-checked="true"] { background: var(--who, var(--ink)); border-color: var(--who, var(--ink)); }
.check[aria-checked="true"]::after { opacity: 1; transform: rotate(-45deg) scale(1); }

.card-main {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 2px 0 2px;
  color: inherit;
  cursor: pointer;
}

.card-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--who, var(--ink-faint));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.who-name { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }

.pill {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #F1F3F8;
  color: var(--ink-soft);
}
.pill--soon  { background: rgba(245, 165, 36, .16); color: #B37200; }
.pill--today { background: rgba(61, 123, 255, .14); color: #2A5FD0; }
.pill--late  { background: rgba(229, 72, 77, .13); color: var(--danger); }

.grip {
  flex: 0 0 auto;
  align-self: center;
  width: 18px;
  color: #C7CEDC;
  font-size: 15px;
  line-height: 1;
  letter-spacing: -2px;
  text-align: center;
  cursor: grab;
}

.cards--done .card { opacity: .6; box-shadow: none; }
.cards--done .card-title { text-decoration: line-through; }
.cards--done .grip { display: none; }

/* --- Deadlinet -------------------------------------------------------- */

.deadlines { display: flex; flex-direction: column; gap: 10px; }

.dl {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-1);
}

.dl-num {
  flex: 0 0 62px;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 12px;
  padding: 8px 4px;
  background: #F1F3F8;
}
.dl-num b {
  display: block;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.dl-num span {
  display: block;
  margin-top: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.dl-num[data-state="soon"]  { background: rgba(245, 165, 36, .15); }
.dl-num[data-state="soon"] b, .dl-num[data-state="soon"] span { color: #B37200; }
.dl-num[data-state="today"] { background: rgba(61, 123, 255, .13); }
.dl-num[data-state="today"] b, .dl-num[data-state="today"] span { color: #2A5FD0; }
.dl-num[data-state="late"]  { background: rgba(229, 72, 77, .12); }
.dl-num[data-state="late"] b, .dl-num[data-state="late"] span { color: var(--danger); }
.dl-num[data-state="done"] b { color: var(--ok); }

.dl-main {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.dl-title { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.dl-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  overflow-wrap: anywhere;
}

.dl-date { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-faint); }

.bar {
  display: block;
  height: 5px;
  margin-top: 9px;
  border-radius: 999px;
  background: #EDF0F6;
  overflow: hidden;
}
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--who, var(--blue)); }
.dl--late .bar span { background: var(--danger); }

.dl .check { align-self: center; margin-top: 0; }

.deadlines--done .dl { opacity: .6; box-shadow: none; }
.deadlines--done .dl-title { text-decoration: line-through; }

/* --- Tehty-laatikko ---------------------------------------------------- */

.done-drawer { margin-top: 14px; }

.done-drawer summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}
.done-drawer summary::-webkit-details-marker { display: none; }
.done-drawer summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
.done-drawer[open] summary::before { transform: rotate(90deg); }
.done-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.done-drawer .cards, .done-drawer .deadlines { margin-top: 8px; }

/* --- Paneelit ---------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 26, 40, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
#dateOverlay, #cropOverlay, #timeOverlay { z-index: 60; }

.sheet {
  width: 100%;
  max-width: 460px;
  max-height: 92svh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-3);
  animation: rise .18s ease-out;
}

@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

@media (min-width: 700px) {
  .overlay { align-items: center; padding: 20px; }
  .sheet { border-radius: 20px; padding-bottom: 20px; max-height: 88vh; }
  .sheet-handle { display: none; }
}

.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }

.sheet h3 {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 16px;
}

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field > span em { font-style: normal; color: var(--ink-faint); font-weight: 500; }
.field input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  padding: 11px 13px;
  min-height: 46px;
  background: #fff;
}
.field input[type="text"]:focus { outline: none; border-color: var(--blue); }

.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }

.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-faint); text-align: center; }

/* --- Asetukset ---------------------------------------------------------- */

.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }

.swatch {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(20, 30, 60, .08);
}
.swatch[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.people { display: flex; flex-direction: column; gap: 10px; }

.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
}
.person-row .avatar { width: 42px; height: 42px; font-size: 16px; }
.person-row b { flex: 1 1 auto; font-size: 14.5px; font-weight: 600; }
.person-row .mini-btn { box-shadow: none; background: #F1F3F8; }

/* --- Kuvan rajaus --------------------------------------------------------- */

.cropper {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #EDF0F6;
  touch-action: none;
  cursor: grab;
}
.cropper img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; user-select: none; }
.cropper-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.9); pointer-events: none; }

.zoom { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.zoom span { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.zoom input { flex: 1 1 auto; accent-color: var(--blue); }

/* --- Kalenteri -------------------------------------------------------------- */

.sheet--date { max-width: 380px; }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

.cal-nav {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 999px;
  background: #F1F3F8;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}
.cal-nav:hover { background: #E7EAF1; }

.cal-title {
  flex: 1 1 auto;
  border: 0;
  background: none;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  padding-bottom: 4px;
}

.cal-day {
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
}
.cal-day:hover { background: #F1F3F8; }
.cal-day.is-other { color: var(--ink-faint); font-weight: 500; }
.cal-day.is-past { color: var(--ink-faint); }
.cal-day.is-weekend { color: var(--rose); }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--blue); color: var(--blue); }
.cal-day.is-selected { background: var(--ink); color: #fff; }
.cal-day.is-selected.is-today { box-shadow: none; }

.cal-quick { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; scrollbar-width: none; }
.cal-quick::-webkit-scrollbar { display: none; }
.cal-quick button {
  flex: 0 0 auto;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
  padding: 0 14px;
}
.cal-quick button:hover { border-color: var(--blue); color: var(--blue); }

/* --- Ilmoitus ---------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 13px 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-3);
  max-width: 92vw;
}
.toast--error { background: var(--danger); }
.toast-undo {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 13px;
}

/* --- Kirjautuminen -------------------------------------------------------------- */

.login-body { display: grid; place-items: center; min-height: 100svh; padding: 24px; }
.login {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-3);
}
.login .today { color: var(--ink-faint); }
.login h1 { font-family: var(--display); font-size: 30px; font-weight: 600; margin: 2px 0 22px; }
.login-form label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.login-form input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  padding: 13px 14px;
  min-height: 50px;
}
.login-form input:focus { outline: none; border-color: var(--blue); }
.login-form button {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  min-height: 50px;
}
.login-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 10px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Eräpäiväjärjestyksessä kortteja ei raahata */
.cards--nodrag .grip { display: none; }

/* ==================================================================
   Palaverit
   ================================================================== */

.meetings { display: flex; flex-direction: column; gap: 10px; }

.mt {
  min-width: 0;
  background: var(--card);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-1);
  padding: 12px;
}

.mt-row { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }

.mt-date {
  flex: 0 0 54px;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 12px;
  padding: 7px 4px;
  background: #F1F3F8;
}
.mt-date b {
  display: block;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.mt-date span {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mt-date[data-state="today"] { background: rgba(61, 123, 255, .13); }
.mt-date[data-state="today"] b, .mt-date[data-state="today"] span { color: #2A5FD0; }
.mt-date[data-state="soon"] { background: rgba(245, 165, 36, .15); }
.mt-date[data-state="soon"] b, .mt-date[data-state="soon"] span { color: #B37200; }
.mt-date[data-state="past"] { background: #F1F3F8; opacity: .7; }
.mt-date[data-state="done"] b { color: var(--ok); }

.mt-main {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.mt-title {
  display: block;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.mt-when {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}
.mt--past .mt-when { color: var(--ink-faint); }

.mt-meta {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.mt-notes {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-faint);
  overflow: hidden;
  overflow-wrap: anywhere;
}

.mt-join {
  display: block;
  margin-top: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(61, 123, 255, .1);
  color: #2A5FD0;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-join:hover { background: rgba(61, 123, 255, .18); }

.mt .check { align-self: center; margin-top: 0; }

.meetings--done .mt { opacity: .6; box-shadow: none; }
.meetings--done .mt-title { text-decoration: line-through; }

/* Lomakkeen lisäkentät */
.composer-field {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 9px 2px;
  font-size: 15px;
  font-weight: 500;
}
.composer-field::placeholder { color: var(--ink-faint); }
.composer-field:focus { outline: none; }

textarea.composer-field,
.field textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 62px;
  line-height: 1.45;
}

.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  padding: 11px 13px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
}
.field textarea:focus { outline: none; border-color: var(--blue); }

.two-up { display: flex; gap: 10px; }
.two-up > * { flex: 1 1 0; min-width: 0; }

/* ==================================================================
   Kellonajan valinta
   ================================================================== */

.sheet--time { max-width: 340px; }

.wheels {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 4px;
}

.wheel {
  flex: 0 0 96px;
  height: 200px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 78px 0;
  text-align: center;
}
.wheel::-webkit-scrollbar { display: none; }

.wheel-item {
  display: block;
  width: 100%;
  height: 44px;
  line-height: 44px;
  border: 0;
  background: none;
  scroll-snap-align: center;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink-faint);
  transition: color .12s, transform .12s;
}
.wheel-item.is-active { color: var(--ink); transform: scale(1.12); }

.wheel-sep {
  align-self: center;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 2px;
}

.wheel-bar {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 44px;
  margin-top: -22px;
  border-radius: 12px;
  background: rgba(61, 123, 255, .09);
  pointer-events: none;
}

.wheel-hint { margin: 2px 0 0; font-size: 12px; color: var(--ink-faint); text-align: center; }
