/* Personel Planner — kawaii çıkartma defteri: haftanın her günü kendi pastel renginde,
   personel kendi simgesiyle bir çıkartma gibi. Haftalık raporla aynı dünya. */

:root {
  --board: #FFF1F7;        /* sakura pembesi zemin */
  --dots: rgba(214, 51, 127, .07);
  --surface: #FFFDFE;      /* süt beyazı */
  --surface-2: #FBF3FA;
  --ink: #3D2C5E;          /* mor mürekkep */
  --muted: #776B95;
  --line: #EEDDEF;
  --accent: #D6337F;       /* şeker pembesi */
  --accent-ink: #FFFFFF;
  --accent-soft: #FFE0EE;
  --near: #D98A00;         /* limite yaklaşıyor: şeftali */
  --over: #D93A63;         /* limit aşıldı: mercan */
  --over-bg: #FFE6EC;
  --ok: #2FA37A;           /* nane */
  --sun: #FBC93A;
  --shadow: 0 2px 0 rgba(61, 44, 94, .06), 0 4px 14px rgba(214, 51, 127, .08);
  --lift: 0 14px 34px rgba(61, 44, 94, .25);

  /* Haftanın günleri: raporla aynı gökkuşağı (yazı, zemin) */
  --d0: #2A62D6; --d0-bg: #E2F1FC;
  --d1: #1F9150; --d1-bg: #E4F6E3;
  --d2: #C76A00; --d2-bg: #FFF1D9;
  --d3: #D63A33; --d3-bg: #FFE5E3;
  --d4: #D6337F; --d4-bg: #FDE3F0;
  --d5: #6C42CF; --d5-bg: #EDE6FB;
  --d6: #1C80C2; --d6-bg: #E0F1FB;

  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-cond: "Fredoka", "Nunito", system-ui, sans-serif;   /* başlıklar, günler, sayılar */

  --pool-w: clamp(220px, 19vw, 290px);
  --head-col: 112px;
  --r-s: 10px;
  --r-m: 22px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --board: #1D1630;
    --dots: rgba(255, 143, 199, .06);
    --surface: #2A2140;
    --surface-2: #33294D;
    --ink: #F3EAFB;
    --muted: #B6A8D3;
    --line: #463A63;
    --accent: #FF8FC7;
    --accent-ink: #2A1030;
    --accent-soft: #4A2A4F;
    --near: #FFC14D;
    --over: #FF7C98;
    --over-bg: #4A2234;
    --ok: #5FD3A6;
    --shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .25);
    --lift: 0 14px 34px rgba(0, 0, 0, .55);
    --d0: #8FB8FF; --d0-bg: #26304D;
    --d1: #7EDB9F; --d1-bg: #233A33;
    --d2: #FFC277; --d2-bg: #3D3127;
    --d3: #FF9A93; --d3-bg: #40272C;
    --d4: #FF8FC7; --d4-bg: #432641;
    --d5: #C3A6FF; --d5-bg: #322A52;
    --d6: #86CCF5; --d6-bg: #233648;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.4 var(--font);
  color: var(--ink);
  background-color: var(--board);
  background-image: radial-gradient(var(--dots) 1.5px, transparent 1.6px);
  background-size: 18px 18px;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px);
}
button, input { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; font-family: var(--font-cond); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Üst çubuk ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px 12px;
  background: var(--surface); color: var(--ink);
  border-bottom: 3px dotted color-mix(in srgb, var(--accent) 45%, transparent);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { width: 34px; height: 34px; flex: none; }
.brand h1 { font-size: 22px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.live { width: 9px; height: 9px; border-radius: 50%; background: #B9AECF; flex: none; }
.live.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.live.off { background: var(--near); }

.weeknav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.weeklabel { display: grid; text-align: center; min-width: 190px; line-height: 1.15; }
.weeklabel strong { font-family: var(--font-cond); font-size: 19px; font-weight: 600; color: var(--accent); }
.weeklabel small { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; }

.btn {
  border: 2px solid transparent; border-radius: 999px;
  padding: 6px 15px; cursor: pointer; font: 600 14.5px var(--font-cond); white-space: nowrap;
  background: var(--surface-2); color: var(--ink);
  transition: transform .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.full { width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, var(--ink)); }
.btn.primary:active { box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, var(--ink)); }
.btn.danger { background: transparent; color: var(--over); border-color: currentColor; }
.btn.ghost { background: transparent; border-color: var(--line); }
.topbar .btn.ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; font-size: 22px; line-height: 1; color: inherit;
}
.icon-btn:hover, .btn.ghost:hover, .topbar .btn.ghost:hover { background: var(--accent-soft); }

/* ---------- Yerleşim ---------- */
.layout {
  display: grid; grid-template-columns: var(--pool-w) minmax(0, 1fr);
  height: calc(100% - 56px - env(safe-area-inset-top, 0px));
  transition: grid-template-columns .18s ease;
}
/* Masaüstü: üst çubuk kaç satır olursa olsun plan kalan yüksekliği doldurur */
@media (min-width: 821px) {
  body:not(.login-page) { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
  body:not(.login-page) .layout { flex: 1; min-height: 0; height: auto; }
}

/* ---------- Personel havuzu ---------- */
.pool {
  border-right: 3px dotted color-mix(in srgb, var(--accent) 25%, transparent);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  display: flex; flex-direction: column; min-height: 0;
}
.pool-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 6px; }
.pool-head h2 { font-size: 19px; font-weight: 600; }
.pool-head input {
  flex: 1; min-width: 0; padding: 6px 12px; border: 2px solid var(--line);
  border-radius: 999px; background: var(--surface);
}
.pool-head input:focus { outline: none; border-color: var(--accent); }
.pool-hint { margin: 0 14px 8px; color: var(--muted); font-size: 13px; }
.pool-list { overflow: auto; padding: 4px 14px 24px; display: grid; gap: 8px; align-content: start; }
.pool-empty { color: var(--muted); padding: 12px 0; }

/* Daraltma düğmesi ve dar şerit */
.pool-toggle { flex: none; width: 28px; height: 28px; font-size: 20px; color: var(--muted); }
body.pool-collapsed { --pool-w: 76px; }
body.pool-collapsed .pool-head { justify-content: center; padding: 12px 6px 6px; }
body.pool-collapsed .pool-head h2,
body.pool-collapsed .pool-head input,
body.pool-collapsed .pool-hint { display: none; }
body.pool-collapsed .pool-list { padding: 4px 8px 24px; justify-items: center; gap: 10px; }
.magnet.mini { width: 58px; padding: 6px 4px 5px; justify-items: center; gap: 3px; }
.magnet.mini::before { display: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 18%, var(--surface)); border: 2.5px solid var(--c);
  color: color-mix(in srgb, var(--c) 80%, var(--ink)); font: 600 14px var(--font-cond);
}
.mini-h { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mini-h.near { color: var(--near); }
.mini-h.over { color: var(--over); }

/* Personel kartı: kişinin simgesiyle bir çıkartma */
.magnet {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; align-items: start;
  padding: 10px 12px 11px 10px;
  background: var(--surface); border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--c) 30%, var(--surface));
  box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 22%, transparent);
  cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: none;
}
.magnet:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--surface)); }
.magnet .stk {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
}
.magnet .stk svg { width: 22px; height: 22px; }
.magnet .mbody { display: grid; gap: 5px; min-width: 0; }
.magnet.mini { display: grid; grid-template-columns: none; border-radius: 16px; }
.magnet.selected { outline: 3px solid var(--accent); outline-offset: 2px; }
.magnet.flash { animation: flash .7s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 45%, transparent); } }
.magnet .who { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; min-width: 0; line-height: 1.2; }
.magnet .who small { grid-column: 1; grid-row: 2; font-size: 12px; }
.magnet .who .warn-icon { grid-column: 2; grid-row: 1; }
.magnet .who b { font: 600 15.5px var(--font-cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.magnet .who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.magnet .warn-icon { margin-left: auto; color: var(--over); font-weight: 700; }

.meter { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.meter > span:first-child { color: var(--muted); }
.meter .val { font: 600 13px var(--font-cond); }
.meter .val i { font-style: normal; color: var(--muted); font-weight: 400; }
.track { position: relative; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--c, var(--ok)) 12%, var(--surface-2)); overflow: hidden; }
.track .fill { position: absolute; inset: 0 auto 0 0; background: var(--ok); border-radius: 999px; transition: width .25s ease; }
.track .limit { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .35; }
.meter.near .fill { background: var(--near); }
.meter.over .fill { background: var(--over); }
.meter.over .val { color: var(--over); }

/* ---------- Plan ---------- */
.board { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.grid-scroll { overflow: auto; flex: 1; padding: 12px 14px 30px; }
.grid {
  display: grid;
  /* 7 gün her zaman ekran genişliğine sığar; yana kaydırma yok */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  container-type: inline-size;
}
.day-head {
  position: relative;
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px;
  padding: 7px 12px 8px; border-radius: 16px;
  background: var(--dbg, var(--surface)); color: var(--dc, var(--ink));
  border: 2px solid color-mix(in srgb, var(--dc, var(--line)) 22%, transparent);
}
.day-head span { font: 600 15px var(--font-cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-head .ds { display: none; }
.day-head strong { font-family: var(--font-cond); font-size: 25px; font-weight: 600; line-height: 1; justify-self: end; }
.day-head small { grid-column: 1 / -1; color: var(--ink); opacity: .7; font-size: 12px; }
.day-head small.closed { color: var(--over); opacity: 1; font-weight: 700; }
/* Bugün: günün renginde dolu kapsül + küçük kalp */
.day-head.today { background: var(--dc); color: var(--surface); border-color: var(--dc); }
.day-head.today small { color: inherit; opacity: .9; }
.day-head.today::after {
  content: "♥"; position: absolute; top: -10px; left: 12px; font-size: 15px; line-height: 1;
  color: var(--accent); background: var(--surface); border-radius: 50%; padding: 3px 4px 2px;
  box-shadow: var(--shadow);
}


.cell {
  min-height: 150px; padding: 7px; border-radius: 18px; min-width: 0;
  background: var(--surface); border: 2px dashed color-mix(in srgb, var(--dc, var(--line)) 28%, var(--line));
  display: flex; flex-direction: column; gap: 6px;
  transition: background .12s, border-color .12s;
}
.cell.weekend { background: color-mix(in srgb, var(--surface) 80%, var(--dbg, var(--board))); }
body.selecting .cell { cursor: copy; }
body.dragging .cell { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cell .empty { margin: auto; color: var(--muted); font-size: 12.5px; text-align: center; padding: 8px; line-height: 1.35; }
.cell .empty::before { content: "♡"; display: block; font-size: 20px; color: color-mix(in srgb, var(--dc, var(--accent)) 55%, transparent); }
body.dragging .cell .empty { visibility: hidden; }
.cell.over-target {
  border-style: solid; border-color: var(--dc, var(--accent));
  background: var(--dbg, var(--accent-soft));
}

.chip {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px;
  padding: 6px 9px 7px; border-radius: 14px; font-size: 13px; line-height: 1.2;
  background: color-mix(in srgb, var(--c) 13%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--c) 32%, var(--surface));
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
}
.chip:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--surface)); }
.chip .ctop { display: flex; align-items: center; gap: 5px; min-width: 0; }
.chip .ctop svg { width: 15px; height: 15px; flex: none; }
.chip b { font: 600 13.5px var(--font-cond); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: color-mix(in srgb, var(--c) 55%, var(--ink)); }
.chip .row2 { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 6px; }
.chip .tm { color: var(--muted); font-size: 12px; }
.chip .hrs { font: 600 11.5px var(--font-cond); padding: 0 7px; border-radius: 999px; background: var(--surface); color: color-mix(in srgb, var(--c) 60%, var(--ink)); }
.chip .span { position: relative; height: 4px; margin-top: 3px; border-radius: 999px; background: color-mix(in srgb, var(--c) 15%, var(--surface)); }
.chip .span i { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--c); }
.chip.outside .tm { color: var(--over); }
.chip .note { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.over b::after { content: " ⚠"; color: var(--over); }
.chip.pending { opacity: .6; }

@container (max-width: 860px) {
  .day-head { padding: 6px 7px; column-gap: 4px; }
  .day-head .dl { display: none; }
  .day-head .ds { display: inline; }
  .day-head strong { font-size: 21px; }
  .cell { padding: 4px; }
  .chip { font-size: 12px; padding: 5px 7px 6px; }
  .chip b { font-size: 12.5px; }
  .chip .ctop svg { width: 13px; height: 13px; }
  .chip .tm, .chip .hrs { font-size: 11px; }
  .dayend { padding: 7px 7px 8px; font-size: 12px; }
  .cov-scale { font-size: 10px; }
}

/* Gün sonu: kişi başı saat + açılış saatleri kapsandı mı */
.dayend {
  padding: 9px 11px 11px; border-radius: 18px; background: var(--surface);
  border: 2px solid var(--line); font-size: 13px; display: grid; gap: 6px; align-content: start;
}
.dayend.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--surface)); }
.dayend.gap { border-color: color-mix(in srgb, var(--over) 40%, var(--surface)); }
.dayend h4 { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.cov { position: relative; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.cov i { position: absolute; top: 0; bottom: 0; }
.cov i.c0 { background: repeating-linear-gradient(135deg, var(--over) 0 3px, var(--over-bg) 3px 7px); }
.cov i.c1 { background: var(--ok); }
.cov i.c2 { background: color-mix(in srgb, var(--ok) 65%, var(--ink)); }
.cov-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: -3px; }
.cov-status { font-weight: 600; }
.cov-status.ok { color: var(--ok); }
.cov-status.gap { color: var(--over); }
.cov-status.closed { color: var(--muted); font-weight: 500; }
.dayend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.dayend li { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center; }
.dayend li .d { width: 14px; height: 14px; display: grid; place-items: center; }
.dayend li .d svg { width: 14px; height: 14px; }
.dayend li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayend li b { font: 600 13px var(--font-cond); }
.dayend .total { display: flex; justify-content: space-between; border-top: 2px dotted var(--line); padding-top: 6px; font: 600 14px var(--font-cond); }
.dayend .none { color: var(--muted); }

/* Sürükleme */
.drag-src { opacity: .35; }
.drag-ghost .meter { display: none; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none;
  box-shadow: var(--lift); transform-origin: 20px 20px; opacity: .97;
  rotate: -4deg; scale: 1.04;
}
body.dragging, body.dragging * { cursor: grabbing !important; }

.trash {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 90;
  translate: -50% 160%; visibility: hidden; transition: translate .18s ease, background .12s, visibility .18s;
  padding: 14px 26px; border-radius: 999px; font: 600 15px var(--font-cond);
  background: var(--surface); color: var(--over); border: 2px dashed var(--over); box-shadow: var(--lift);
}
body.dragging-assignment .trash { translate: -50% 0; visibility: visible; }
.trash.over-target { background: var(--over); color: #fff; border-style: solid; }

.install-banner {
  display: flex; align-items: center; gap: 12px; margin: 12px 14px 0; padding: 10px 10px 10px 12px;
  border-radius: 20px; background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--accent) 30%, var(--surface));
  box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 15%, transparent);
}
.install-banner img { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.install-banner .ib-text { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: 13px; color: var(--muted); }
.install-banner .ib-text b { font: 600 15px var(--font-cond); color: var(--ink); }
.install-acc { margin-top: 14px; }
.offline .login-card p { margin: 0 0 16px; line-height: 1.5; }
.login-brand img.logo { border-radius: 16px; }

.select-banner {
  display: flex; align-items: center; gap: 10px; margin: 12px 18px 0; padding: 8px 10px 8px 16px;
  border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-weight: 600;
}
.select-banner span { flex: 1; }

/* ---------- Bildirimler ---------- */
.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 120; display: grid; gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  padding: 11px 16px; border-radius: 18px; background: var(--ink); color: var(--surface);
  box-shadow: var(--lift); font-size: 14px; font-weight: 600; animation: toastIn .22s cubic-bezier(.3, 1.4, .5, 1);
}
.toast.warn { background: #FFE3A3; color: #4A2F00; }
.toast.error { background: var(--over); color: #fff; }
@keyframes toastIn { from { translate: 0 10px; scale: .96; opacity: 0; } }

/* ---------- Diyaloglar ---------- */
dialog.sheet {
  border: 0; padding: 0; border-radius: var(--r-m); width: min(460px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: var(--lift);
}
dialog.sheet.wide { width: min(860px, calc(100vw - 24px)); }
dialog.sheet:focus, dialog.sheet:focus-visible { outline: none; }
dialog::backdrop { background: rgba(61, 44, 94, .35); backdrop-filter: blur(2px); }
.sheet form, .sheet > .manage { padding: 0 20px 18px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.sheet-head h3 { font-size: 22px; font-weight: 600; }
.sheet-head small { color: var(--muted); }
.swatch {
  width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 15%, var(--surface)); border: 2.5px solid var(--c);
}
.swatch svg { width: 26px; height: 26px; }
.sheet-foot { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.spacer { flex: 1; }

label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input {
  padding: 8px 12px; border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); font-size: 15px; min-width: 0;
}
label input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
label input[type="color"] { padding: 2px; height: 38px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); align-self: end; padding-bottom: 8px; }
.fields { display: grid; gap: 10px; }
.fields.two { grid-template-columns: 1fr 1fr; }
.fields.three { grid-template-columns: 1fr 1fr 1fr; }

.preview { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); font-size: 14px; border: 2px dotted var(--line); }
.preview .over { color: var(--over); font-weight: 600; }
.preview .ok { color: var(--ok); font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.quick button { border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 13px; cursor: pointer; font: 600 13.5px var(--font-cond); }
.quick button:hover { background: var(--accent-soft); }
.quick button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.hours-rows { display: grid; gap: 6px; padding: 0 0 4px; }
.hours-row { display: grid; grid-template-columns: 96px 70px 1fr 1fr; gap: 8px; align-items: center; }
.hours-row > span { font: 600 15px var(--font-cond); }
.hours-row label { margin: 0; }
.hours-row.closed input[type="time"] { opacity: .4; }
.notice { margin: 0 0 12px; padding: 10px 14px; border-radius: 16px; background: color-mix(in srgb, var(--near) 22%, var(--surface)); }
.version { margin: 14px 0 0; color: var(--muted); font-size: 12px; text-align: right; }
.form-error { margin: 0 0 12px; color: var(--over); font-weight: 600; }

/* Giriş sayfası */
.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 20px; }
.login { width: min(390px, 100%); display: grid; gap: 18px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand .logo { width: 64px; height: 64px; flex: none; }
.login-brand h1 { font-size: 36px; font-weight: 600; line-height: 1.05; }
.login-brand p { margin: 4px 0 0; color: var(--muted); }
.login-card {
  position: relative; background: var(--surface); border-radius: 26px; padding: 24px;
  border: 2px solid color-mix(in srgb, var(--accent) 22%, var(--surface));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 18%, transparent);
}
.login-card::after { content: "♥"; position: absolute; top: -14px; right: 22px; font-size: 24px; color: var(--accent); }
.login-card h2 { font-size: 21px; font-weight: 600; }
.login-card .btn.primary { padding: 10px; font-size: 16px; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.lang-select {
  border: 2px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  padding: 5px 10px; font: 600 13px var(--font-cond); cursor: pointer;
}
.topbar .lang-select option { color: #111; background: #fff; }

.manage { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; }
.manage-list { min-height: 0; }
.rows { list-style: none; margin: 10px 0 0; padding: 0; max-height: 52vh; overflow: auto; display: grid; gap: 4px; }
.rows li {
  display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 14px; cursor: pointer;
}
.rows li:hover { background: var(--surface-2); }
.rows li.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.rows li .bar { width: 10px; height: 28px; border-radius: 999px; background: var(--c); }
.rows li small { color: var(--muted); display: block; }
.rows li.inactive { opacity: .55; }
.manage-form h4 { font-size: 18px; font-weight: 600; margin: 4px 0 12px; }

.daytabs { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .actions #copyWeekBtn { display: none; }
  .actions #userName { max-width: 80px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
}

/* ---------- Mobil: tek gün görünümü + altta personel şeridi ---------- */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .topbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; position: static; }
  .weeklabel strong { font-size: 17px; white-space: nowrap; }
  .magnet .who small { display: none; }
  .brand h1 { font-size: 18px; }
  .weeknav { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .weeklabel { min-width: 0; flex: 1; }
  /* Mobil: işlem düğmeleri tam genişlikte, gerekirse yana kayan tek satır */
  .actions {
    order: 2; width: 100%; margin: 0; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .actions::-webkit-scrollbar { display: none; }
  .actions .btn, .actions .lang-select { flex: none; padding: 6px 10px; font-size: 14px; }
  .topbar .lang-select { max-width: 120px; }
  html, body { overflow-x: hidden; }

  .layout { display: flex; flex-direction: column-reverse; height: auto; min-height: calc(100dvh - 100px); }
  .board { flex: 1; padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
  .grid-scroll { overflow: visible; padding: 10px 12px; }
  .grid { grid-template-columns: 1fr; min-width: 0; }
  .day-head .dl { display: inline; }
  .day-head .ds { display: none; }
  .day-head strong { font-size: 25px; }
  .off-m { display: none; }
  .cell { min-height: 120px; }
  .hours-row { grid-template-columns: 1fr 1fr; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .chip { font-size: 14px; padding: 7px 9px; }

  .daytabs {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
    padding: 10px 12px 8px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--board);
  }
  .daytab {
    display: grid; justify-items: center; padding: 6px 0; border: 0; border-radius: var(--r-s);
    background: var(--surface); cursor: pointer; line-height: 1.1;
  }
  .daytab { background: var(--dbg, var(--surface)); color: var(--dc, var(--ink)); border-radius: 14px; }
  .daytab span { font: 600 12px var(--font-cond); }
  .daytab strong { font-family: var(--font-cond); font-size: 20px; font-weight: 600; }
  .daytab small { font-size: 11px; color: var(--ink); opacity: .7; }
  .daytab.today strong::after { content: "♥"; font-size: 10px; vertical-align: super; color: var(--accent); }
  .daytab[aria-selected="true"] { background: var(--dc, var(--ink)); color: var(--surface); }
  .daytab[aria-selected="true"] span, .daytab[aria-selected="true"] small { color: inherit; opacity: .75; }
  .daytab[aria-selected="true"] strong { color: inherit; }
  .daytab.over-target { outline: 2px solid var(--accent); }

  .pool {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface);
    border-right: 0; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -6px 18px rgba(27, 42, 58, .12);
  }
  .pool-head { padding: 8px 12px 4px; }
  .pool-head h2 { font-size: 16px; }
  .pool-hint, .pool-toggle { display: none; }
  .pool-list {
    grid-auto-flow: column; grid-auto-columns: 172px; overflow-x: auto; overflow-y: hidden;
    padding: 4px 12px 12px; scroll-snap-type: x proximity;
  }
  .magnet { scroll-snap-align: start; touch-action: pan-x; padding: 8px 10px; grid-template-columns: minmax(0, 1fr); }
  .magnet .stk { display: none; }
  .meter { grid-template-columns: 34px 1fr; }
  .meter .track { display: none; }

  .toasts { left: 12px; right: 12px; width: auto; bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
  .trash { bottom: calc(170px + env(safe-area-inset-bottom, 0px)); }
  .select-banner { margin: 10px 12px 0; }

  dialog.sheet, dialog.sheet.wide {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-m) var(--r-m) 0 0;
    max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .manage { grid-template-columns: 1fr; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-foot .spacer { display: none; }
  .sheet-foot .btn.primary { flex: 1; }
  .sheet-foot .btn.danger { order: 3; flex-basis: 100%; }
  .rows { max-height: 28vh; }
  .fields.three { grid-template-columns: 1fr 1fr; }
  .fields.three label:last-child { grid-column: 1 / -1; }
}

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