/* Tema renkleri: açık tema varsayılan; koyu tema <html data-theme="dark"> ile gelir. Çıktılar (print.css) her zaman açıktır. */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #f7f8f9;
  --hover: #f1f2f4;
  --track: #eceef1;
  --line: #e2e4e8;
  --line-2: #cfd3d9;
  --text: #1f2328;
  --text-2: #444a52;
  --muted: #6b717b;
  --muted-2: #a9aeb5;
  --strong: #1b1b1b;
  --ink: #000000;
  --accent: #00a39a;
  --accent-2: #008c84;
  --accent-soft: #e3f6f4;
  --accent-line: #bfe8e4;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --danger-line: #f1c4bf;
  --danger-text: #8c2a20;
  --warn: #b7791f;
  --warn-soft: #fdf5e6;
  --warn-line: #f1dcb2;
  --warn-text: #7a5212;
  --ok: #2f855a;
  --ok-soft: #eaf6ef;
  --ok-line: #c4e5d1;
  --ok-text: #22643f;
  --slot-alt: #f4f4f5;
  --slot-hover: #eaf6f5;
  --slot-dot: #e3e5e8;
  --slot-line: #cfd2d7;
  --col-line: #c9ccd1;
  --backdrop: rgba(20, 22, 26, .38);
  --shadow: rgba(0, 0, 0, .15);
  --slot: 20px;
  --radius: 8px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1d2229;
  --hover: #232931;
  --track: #2a3038;
  --line: #2a3038;
  --line-2: #3a414b;
  --text: #e5e8ec;
  --text-2: #c3c8cf;
  --muted: #98a1ac;
  --muted-2: #6c7580;
  --strong: #e5e8ec;
  --ink: #ffffff;
  --accent: #14b3a8;
  --accent-2: #0f9d93;
  --accent-soft: #10302e;
  --accent-line: #1d5a55;
  --danger: #ef6b5d;
  --danger-soft: #3a1d1b;
  --danger-line: #6a2e28;
  --danger-text: #f3a79e;
  --warn: #e0a846;
  --warn-soft: #33290f;
  --warn-line: #5c4a1d;
  --warn-text: #efcf8f;
  --ok: #4fc48a;
  --ok-soft: #12301f;
  --ok-line: #245a3c;
  --ok-text: #9fe0bd;
  --slot-alt: #1b2026;
  --slot-hover: #16322f;
  --slot-dot: #242a31;
  --slot-line: #323941;
  --col-line: #353c45;
  --backdrop: rgba(0, 0, 0, .6);
  --shadow: rgba(0, 0, 0, .5);
}
/* Tema değişirken ani parlamayı önle */
:root[data-theme="dark"] img { opacity: .95; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { transition: none !important; animation: none !important; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif; font-size: 13px; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden; user-select: none;
}
input, select, textarea, button { font: inherit; color: inherit; }
input, textarea { user-select: text; }
.ic { display: block; flex: none; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); background: var(--panel); border-radius: 7px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); border-color: var(--muted-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.small.icon { width: 26px; }
.btn.block { width: 100%; justify-content: center; }
.btn.big { height: 40px; font-size: 14px; }

.field {
  height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel); min-width: 0;
}
.field:focus, textarea:focus { outline: 2px solid rgba(0, 163, 154, .35); outline-offset: -1px; border-color: var(--accent); }
select.field { padding-right: 4px; }
textarea.field { height: auto; padding: 7px 8px; resize: none; line-height: 1.4; }
input[type=color] {
  width: 26px; height: 26px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: none; cursor: pointer; flex: none;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 4px; }
label.lbl { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- top bar ---------- */
.topbar {
  height: 54px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-family: 'Bebas Neue', sans-serif; font-size: 25px; letter-spacing: .03em; font-style: normal; margin-right: 10px; color: var(--strong); white-space: nowrap; }
.plan-picker { display: flex; gap: 6px; align-items: center; }
.plan-picker select { height: 32px; min-width: 240px; border: 1px solid var(--line-2); border-radius: 7px; padding: 0 8px; background: var(--panel); font-weight: 600; }
.spacer { flex: 1; }
.modes { display: flex; background: var(--hover); border-radius: 9px; padding: 3px; gap: 2px; margin-right: 6px; }
.modes button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: none; border-radius: 7px;
  background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.modes button:hover { color: var(--text); }
.modes button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* haftalık görünüm üst bağlam şeridi */
.week-context { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; }
.wc-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px;
  background: color-mix(in srgb, var(--c) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 40%, var(--panel));
  max-width: 280px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.wc-chip b { color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.wc-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }
.wc-theme {
  flex: 1; min-width: 200px; height: 30px; border: 1px dashed var(--line-2); border-radius: 7px; padding: 0 10px;
  font-weight: 700; font-size: 14px; background: var(--panel);
}
.wc-theme:focus { outline: 2px solid rgba(0,163,154,.35); border-style: solid; border-color: var(--accent); }

/* ---------- layout ---------- */
.layout { flex: 1; min-height: 0; display: flex; }
.board { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 10px 12px 8px 12px; gap: 8px; }
.board-bar { display: flex; align-items: center; gap: 10px; flex: none; }
.board-hint { flex: none; font-size: 11px; color: var(--muted); text-align: center; }

.sidebar {
  width: 410px; flex: none; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}

/* ---------- palette ---------- */
.palette { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.palette .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.palette .ptitle { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px 0 6px; border-radius: 13px;
  border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-size: 12px; white-space: nowrap;
}
.chip:hover { border-color: var(--muted-2); }
.chip .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.chip.active { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); font-weight: 600; }
.chip .cnt { color: var(--muted); font-size: 11px; font-weight: 500; }

/* ---------- grid ---------- */
.grid {
  flex: 1; min-height: 0; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative;
}
.g-head {
  display: grid; grid-template-columns: 52px repeat(7, minmax(92px, 1fr)); position: sticky; top: 0; z-index: 20;
  background: var(--panel); border-bottom: 2px solid var(--strong);
}
.g-day { padding: 6px 6px 5px; text-align: center; border-left: 1px solid var(--line); line-height: 1.2; }
.g-day .dn { font-weight: 700; font-size: 12.5px; }
.g-day .dd { font-size: 11px; color: var(--muted); }
.g-day .dh { display: block; font-size: 10px; color: #2e8b57; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .g-day .dh, :root[data-theme="dark"] .wc-hijri { color: #5fc792; }
.wc-hijri { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #2e8b57; white-space: nowrap; }
.g-day .dl { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.g-day.over .dl { color: var(--danger); font-weight: 600; }
.g-body { display: grid; grid-template-columns: 52px repeat(7, minmax(92px, 1fr)); position: relative; }
.g-times { position: relative; }
.g-times span {
  position: absolute; right: 7px; transform: translateY(-50%); font-size: 10.5px; font-weight: 600; color: var(--text-2);
  background: var(--panel); padding: 0 1px;
}
.g-col { position: relative; border-left: 1px solid var(--col-line); cursor: crosshair; }
.g-slot { height: var(--slot); border-top: 1px dotted var(--slot-dot); background: var(--panel); }
.g-slot.hour { border-top: 1px solid var(--slot-line); }
.g-slot.first { border-top: none; }
.g-slot.alt { background: var(--slot-alt); }
.g-slot.thick { border-top: 2px solid var(--strong); }
.g-col:hover .g-slot:hover { background: var(--slot-hover); }

.g-block {
  position: absolute; left: 3px; right: 3px; border-radius: 5px; z-index: 5; cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,.18); overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: 2px 6px; line-height: 1.15; text-align: center;
}
.g-block.plan { left: 6px; right: 6px; border: 1.5px dashed rgba(255,255,255,.55); }
.g-block.task { left: 6px; right: 6px; border-left: 4px solid rgba(255,255,255,.75); }
.g-block .b-title .ic { display: inline-block; vertical-align: -1px; margin-right: 3px; }
.g-block.done { opacity: .55; }
.g-block.done .b-title { text-decoration: line-through; }
.chip.task .dot { border-radius: 50%; }
.g-block .b-title { font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; }
.g-block .b-time { font-size: 10.5px; opacity: .85; white-space: nowrap; }
.g-block.short { flex-direction: row; gap: 5px; align-items: center; justify-content: center; padding: 0 5px; }
.g-block.short .b-title { -webkit-line-clamp: 1; font-size: 11px; }
.g-block.short .b-time { display: none; }
.g-block.sel { outline: 2.5px solid var(--strong); outline-offset: 1px; z-index: 8; }
.g-block.dragging { opacity: .3; }
.g-block .rh { position: absolute; left: 0; right: 0; height: 6px; cursor: ns-resize; z-index: 2; }
.g-block .rh-top { top: 0; }
.g-block .rh-bot { bottom: 0; }
.g-block .b-del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 4px; border: none; padding: 0;
  display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.35); color: #fff; cursor: pointer; z-index: 3;
}
.g-block:hover .b-del { display: flex; }
.g-block .b-del:hover { background: rgba(0,0,0,.6); }
.g-ghost {
  position: absolute; left: 3px; right: 3px; border-radius: 5px; z-index: 9; pointer-events: none;
  border: 2px dashed var(--strong); background: rgba(0,0,0,.08); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.g-ghost.bad { border-color: var(--danger); background: rgba(192,57,43,.14); color: var(--danger); }
.g-now { position: absolute; left: 0; right: 0; border-top: 2px solid #e53e3e; z-index: 4; pointer-events: none; }

/* ---------- summary ---------- */
.summary { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); flex: none; }
.sum-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 8px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.stat label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.stat .v { font-family: 'Bebas Neue', sans-serif; font-size: 27px; line-height: 1.05; letter-spacing: .02em; }
.stat .v small { font-size: 15px; color: var(--muted); margin-left: 2px; }
.stat .s { font-size: 11px; color: var(--muted); }
.stat.hl { background: var(--accent-soft); border-color: var(--accent-line); }
.s.ok { color: var(--ok); } .s.warn { color: var(--warn); } .s.bad { color: var(--danger); }
.meter { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 8px; display: flex; }
.meter i { display: block; height: 100%; }

/* ---------- tabs ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; padding: 0 8px; }
.tabs button {
  flex: 1; height: 40px; border: none; background: none; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 2.5px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tabs button b {
  width: 18px; height: 18px; border-radius: 50%; background: var(--track); color: var(--text-2); font-size: 11px; display: inline-flex; align-items: center; justify-content: center;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs button.active b { background: var(--accent); color: #fff; }

.panel { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 16px; }
.panel h3 { margin: 2px 0 4px; font-size: 14px; }
.panel h4 { margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.panel p { margin: 0 0 10px; line-height: 1.45; }
.panel .section { margin-top: 14px; }

/* preset list */
.plist { display: flex; flex-direction: column; gap: 6px; }
.pitem { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.pitem.active { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.pitem .field { flex: 1; height: 28px; }
.pitem .pick { font-size: 11px; color: var(--muted); padding: 0 4px; cursor: pointer; white-space: nowrap; }

.blist { display: flex; flex-direction: column; gap: 2px; }
.bitem { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.bitem:hover { background: var(--hover); }
.bitem.sel { background: var(--accent-soft); }
.bitem .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bitem .d { width: 30px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.bitem .t { width: 84px; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-2); }
.bitem .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* category cards */
.alloc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cat-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px 9px; margin-bottom: 8px; background: var(--panel); }
.cat-card .top { display: flex; align-items: center; gap: 6px; }
.cat-card .name { flex: 1; font-weight: 600; border-color: transparent; background: transparent; }
.cat-card .name:hover { border-color: var(--line-2); }
.cat-card textarea { width: 100%; margin-top: 6px; min-height: 36px; font-size: 12.5px; }
.cat-card .opts { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.cat-card .opts select { height: 26px; font-size: 12px; flex: 1; }
.cat-card .opts .ol { font-size: 11px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; background: var(--panel); flex: none; }
.stepper button { width: 26px; height: 28px; border: none; background: var(--hover); cursor: pointer; font-size: 15px; line-height: 1; }
.stepper button:hover { background: var(--hover); }
.stepper input { width: 44px; height: 28px; border: none; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper input:focus { outline: none; background: var(--accent-soft); }
.stepper .u { padding: 0 7px 0 0; font-size: 11px; color: var(--muted); }

/* place tab */
.auto-box { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 10px; padding: 11px; }
.auto-box .opt { display: flex; gap: 7px; align-items: flex-start; margin-top: 8px; cursor: pointer; line-height: 1.35; }
.auto-box .opt input { margin-top: 2px; accent-color: var(--accent); }
.qitem { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 8px; align-items: center; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.qitem:hover { border-color: var(--muted-2); }
.qitem.active { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.qitem .dot { width: 12px; height: 12px; border-radius: 4px; }
.qitem .n { font-weight: 600; }
.qitem .h { font-size: 12px; font-variant-numeric: tabular-nums; }
.qitem .bar { grid-column: 2 / 4; height: 5px; background: var(--track); border-radius: 3px; overflow: hidden; }
.qitem .bar i { display: block; height: 100%; }
.qitem .h.ok { color: var(--ok); } .qitem .h.warn { color: var(--warn); } .qitem .h.bad { color: var(--danger); }
.notice { border-radius: 8px; padding: 8px 10px; margin-top: 10px; font-size: 12px; line-height: 1.4; }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); border: 1px solid var(--warn-line); }
.notice.bad { background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger-line); }
.notice.ok { background: var(--ok-soft); color: var(--ok-text); border: 1px solid var(--ok-line); }

/* settings */
.form { display: flex; flex-direction: column; gap: 10px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.path { font-size: 11px; color: var(--muted); word-break: break-all; background: var(--hover); padding: 6px 8px; border-radius: 6px; }

/* ---------- editor ---------- */
.editor { flex: none; border-top: 1px solid var(--line); background: var(--panel-2); padding: 10px 14px 12px; display: none; box-shadow: 0 -6px 14px rgba(0,0,0,.04); }
.editor.open { display: block; }
.editor .eh { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.editor .eh .dot { width: 14px; height: 14px; border-radius: 4px; }
.editor .eh b { flex: 1; }
.editor .grid3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.editor .swatches { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.editor .sw { width: 22px; height: 22px; border-radius: 5px; cursor: pointer; border: 2px solid transparent; }
.editor .sw.on { border-color: var(--strong); }
.editor .acts { display: flex; gap: 6px; margin-top: 10px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: center; justify-content: center; z-index: 600; }
.modal { background: var(--panel); border-radius: 12px; width: 440px; max-width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .mh { padding: 16px 18px 6px; font-size: 16px; font-weight: 700; }
.modal .mb { padding: 8px 18px 6px; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }
.modal .mf { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--accent); }

.popover { position: fixed; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 10px 30px var(--shadow); padding: 4px; z-index: 650; min-width: 180px; }
.popover button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border: none; background: none; border-radius: 5px; cursor: pointer; text-align: left; }
.popover button:hover { background: var(--hover); }
.popover button.danger { color: var(--danger); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1f2328; color: #fff; padding: 10px 14px; border-radius: 9px; font-size: 13px; z-index: 700;
  transition: opacity .18s, transform .18s; display: flex; align-items: center; gap: 12px; max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.err { background: #8c2a20; }
.toast button { background: rgba(255,255,255,.14); border: none; color: #fff; border-radius: 6px; padding: 4px 9px; cursor: pointer; }
.toast button:hover { background: rgba(255,255,255,.26); }
