:root {
  --bg: #F6F1EA; --surface: #FFFFFF; --surface-2: #FBF8F3; --ink: #26211D; --muted: #7A7069; --line: #E8E0D5;
  --primary: #7C5CBF; --primary-deep: #5E4399; --primary-soft: #EFE9F8; --accent: #E8A27C; --accent-soft: #FBEADF;
  --ok: #3F9A72; --ok-soft: #E3F3EB; --danger: #D65F5F; --danger-soft: #FBE5E5; --warn: #D9A429;
  --serif: "DM Serif Display", Georgia, serif; --sans: "Nunito", -apple-system, "Segoe UI", sans-serif;
  --radius: 16px; --shadow: 0 8px 26px rgba(38, 33, 29, 0.08);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
[data-theme="dark"] {
  --bg: #1B1820; --surface: #251F2D; --surface-2: #2C2536; --ink: #F1EBE4; --muted: #A79DAE; --line: #3A3244;
  --primary: #A88BE0; --primary-deep: #C4ADF0; --primary-soft: #32284A; --accent: #F0B08B; --accent-soft: #4A3527;
  --ok: #6FC49B; --ok-soft: #234233; --danger: #F08484; --danger-soft: #4A2727; --shadow: 0 8px 26px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1820; --surface: #251F2D; --surface-2: #2C2536; --ink: #F1EBE4; --muted: #A79DAE; --line: #3A3244;
    --primary: #A88BE0; --primary-deep: #C4ADF0; --primary-soft: #32284A; --accent: #F0B08B; --accent-soft: #4A3527;
    --ok: #6FC49B; --ok-soft: #234233; --danger: #F08484; --danger-soft: #4A2727; --shadow: 0 8px 26px rgba(0,0,0,.35);
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--sans); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
p { margin: 0; }
.muted { color: var(--muted); } .tiny { font-size: .8rem; } .small { font-size: .88rem; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { font-weight: 500; color: var(--ink); font-size: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: .93rem; cursor: pointer; transition: transform .12s, background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { border-color: var(--primary); } .btn:active { transform: scale(.98); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
[data-theme="dark"] .btn.primary, [data-theme="dark"] .btn.primary:hover { color: #1B1820; }
.btn.ghost { background: transparent; } .btn.danger { color: var(--danger); } .btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.small { padding: 7px 12px; font-size: .84rem; border-radius: 10px; } .btn.wide { width: 100%; } .btn.icon { padding: 8px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-deep); }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--accent-soft); color: #9B4F25; } .chip.danger { background: var(--danger-soft); color: var(--danger); }
[data-theme="dark"] .chip.warn { color: var(--accent); }
.error { color: var(--danger); font-size: .9rem; font-weight: 600; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + var(--sat)) 20px calc(24px + var(--sab)); background: radial-gradient(700px 400px at 100% 0%, rgba(232,162,124,.25), transparent 60%), radial-gradient(600px 400px at 0% 100%, rgba(124,92,191,.22), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 34px 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.login-logo svg { width: 64px; height: 64px; }
.login-card h1 { font-size: 2rem; }

/* App layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: calc(22px + var(--sat)) 16px 22px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 1.15rem; }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a, .tabbar a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--muted); font-weight: 700; padding: 10px 12px; border-radius: 12px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active, .tabbar a.active { background: var(--primary-soft); color: var(--primary-deep); }
.ic { font-style: normal; font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-foot { margin-top: auto; }
.main { padding: calc(26px + var(--sat)) 30px 40px; max-width: 1080px; width: 100%; }
.tabbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: calc(18px + var(--sat)) 16px calc(90px + var(--sab)); }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--sab)); z-index: 40; }
  .tabbar a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: .68rem; border-radius: 10px; }
  .tabbar .ic { width: auto; font-size: 1.25rem; }
  .topbar-mobile { display: flex; }
}
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head .sub { color: var(--muted); margin-top: 4px; }
.mobile-settings { display: none; }
@media (max-width: 860px) { .mobile-settings { display: inline-flex; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; border: 1px dashed var(--line); border-radius: 12px; }
.loading { color: var(--muted); padding: 14px 0; }

/* Clocks */
.clocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.clock { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; position: relative; }
.clock.home { border-color: var(--primary); background: var(--primary-soft); }
.clock .city { font-weight: 800; font-size: .88rem; display: flex; justify-content: space-between; gap: 6px; }
.clock .time { font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; margin-top: 4px; }
.clock .date { font-size: .78rem; color: var(--muted); }
.clock .diff { font-size: .72rem; color: var(--muted); }
.clock .rm { position: absolute; top: 6px; right: 8px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; }

/* Today */
.today-hero { background: linear-gradient(135deg, var(--primary), #A97CD8); color: #fff; border-radius: 22px; padding: 22px 24px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.today-hero h1 { font-size: 2rem; } .today-hero .big { font-family: var(--serif); font-size: 2.6rem; line-height: 1; }
.today-hero .muted { color: rgba(255,255,255,.85); }
.mood-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mood { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .9rem; }
.mood.active { background: var(--accent-soft); border-color: var(--accent); }

/* Lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.item.done { opacity: .6; } .item.done .title { text-decoration: line-through; }
.item .title { font-weight: 700; } .item .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.item .body { flex: 1; min-width: 0; } .item .actions { display: flex; gap: 4px; flex: none; }
.item .actions button { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); font-size: 1rem; }
.item .actions button:hover { background: var(--surface-2); color: var(--ink); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; flex: none; margin-top: 2px; display: grid; place-items: center; color: #fff; font-size: .8rem; }
.check.on { background: var(--ok); border-color: var(--ok); }
.prio-high { border-left: 4px solid var(--danger); } .prio-low { border-left: 4px solid var(--line); } .prio-normal { border-left: 4px solid var(--primary); }
.item.overdue .meta .due { color: var(--danger); font-weight: 700; }
.item.soon .meta .due { color: #9B4F25; font-weight: 700; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .84rem; font-weight: 700; cursor: pointer; color: var(--muted); }
.filters button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="dark"] .filters button.active { color: #1B1820; }

/* Calendar */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head h3 { font-size: 1.15rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { text-align: center; font-size: .7rem; font-weight: 800; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.cal-grid button { aspect-ratio: 1; border: none; background: transparent; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: .9rem; position: relative; color: var(--ink); }
.cal-grid button:hover { background: var(--surface-2); }
.cal-grid button.other { color: var(--line); } .cal-grid button.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-grid button.sel { background: var(--primary); color: #fff; } [data-theme="dark"] .cal-grid button.sel { color: #1B1820; }
.cal-grid button.has::after { content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.entry-editor textarea { min-height: 220px; font-size: 1.02rem; }
.entry-date { font-family: var(--serif); font-size: 1.5rem; }
.attach { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; cursor: pointer; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: .7rem; padding: 14px 6px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.audio-item audio { flex: 1; min-width: 0; height: 36px; }
.audio-item .cap { font-size: .8rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec { display: flex; align-items: center; gap: 10px; }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2 } }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.month-label { font-family: var(--serif); font-size: 1.2rem; margin: 18px 0 8px; }
.lightbox { border: none; background: rgba(0,0,0,.92); padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; color: #fff; }
.lightbox::backdrop { background: rgba(0,0,0,.6); }
.lightbox #lbContent { display: grid; place-items: center; height: 100%; padding: 20px; gap: 10px; grid-template-rows: 1fr auto; }
.lightbox img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 8px; }
.lightbox .lb-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.lightbox .lb-meta input { max-width: 320px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.lb-close { position: absolute; top: calc(12px + var(--sat)); right: 14px; background: rgba(255,255,255,.15); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; z-index: 2; }

/* Dialog */
.dialog { border: none; border-radius: 20px; padding: 0; background: var(--surface); color: var(--ink); width: min(440px, 92vw); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(20, 15, 25, .45); backdrop-filter: blur(2px); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }

/* Toasts */
.toasts { position: fixed; top: calc(12px + var(--sat)); right: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; align-items: flex-end; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; max-width: 420px; box-shadow: var(--shadow); font-weight: 600; display: flex; gap: 12px; align-items: center; animation: slide .25s ease; }
.toast.error { background: var(--danger); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
.toast.reminder { background: var(--surface); color: var(--ink); border: 2px solid var(--accent); }
.toast button { border: none; background: rgba(255,255,255,.15); color: inherit; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 700; font-size: .85rem; }
.toast.reminder button { background: var(--primary-soft); color: var(--primary-deep); }
@keyframes slide { from { transform: translateY(-10px); opacity: 0 } to { transform: none; opacity: 1 } }

/* Zones */
.tz-search { position: relative; }
.tz-list { list-style: none; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-top: 6px; }
.tz-list li { padding: 8px 12px; cursor: pointer; font-size: .9rem; display: flex; justify-content: space-between; }
.tz-list li:hover { background: var(--surface-2); }
.conv-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.conv-table td { padding: 9px 6px; border-top: 1px solid var(--line); font-size: .95rem; }
.conv-table td:last-child { text-align: right; font-family: var(--serif); font-size: 1.15rem; }

/* ADHD dostu bileşenler */
.capture { background: var(--surface); border: 2px solid var(--accent); border-radius: 18px; padding: 14px 16px; margin-bottom: 16px; }
.capture input { border: none; background: transparent; font-size: 1.1rem; padding: 6px 2px; box-shadow: none; }
.capture input:focus { box-shadow: none; }
.capture .row { margin-top: 8px; }
.note-card { background: var(--accent-soft); border: 1px dashed var(--accent); border-radius: 16px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.note-card .emoji { font-size: 1.6rem; flex: none; }
.note-card p { font-weight: 600; }
.note-card button { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; flex: none; }
.top3 .item { border-left-width: 4px; }
.top3-num { font-family: var(--serif); font-size: 1.4rem; color: var(--primary); width: 22px; flex: none; text-align: center; }
.focus { text-align: center; }
.focus .ring { width: 170px; height: 170px; border-radius: 50%; margin: 6px auto 12px; display: grid; place-items: center; background: conic-gradient(var(--primary) var(--p, 0%), var(--surface-2) 0); position: relative; }
.focus .ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.focus .ring b { position: relative; font-family: var(--serif); font-size: 2.3rem; font-weight: 400; }
.focus .task { font-size: .9rem; color: var(--muted); margin-bottom: 8px; min-height: 1.3em; }
.focus .presets { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.focus .presets button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-weight: 700; font-size: .84rem; }
.focus .presets button.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); }
.checkins { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.checkin { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 10px 8px; text-align: center; cursor: pointer; user-select: none; transition: transform .1s; }
.checkin:active { transform: scale(.96); }
.checkin.on { background: var(--ok-soft); border-color: var(--ok); }
.checkin .em { font-size: 1.5rem; display: block; } .checkin .lb { font-size: .75rem; font-weight: 700; color: var(--muted); display: block; margin-top: 2px; }
.checkin .cnt { font-size: .75rem; font-weight: 800; color: var(--ok); }
.countdown { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.countdown i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.streak { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: .88rem; }
.confetti { position: fixed; top: 40%; left: 50%; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; z-index: 200; }
.wins textarea { min-height: 80px; }
.tiny-hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.energy-low { --e: #6FA8DC } .energy-medium { --e: #E3B341 } .energy-high { --e: #E06C6C }
.energy-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--e, var(--line)); display: inline-block; }

.pw-change summary { cursor: pointer; font-weight: 700; color: var(--primary); list-style: none; }
.pw-change summary::before { content: "🔒 "; }

/* Mobil sağlamlaştırma */
.app, .main { min-width: 0; }
.main { overflow-x: hidden; }
.item .body, .item .title, .item .meta span, .note-card p { min-width: 0; overflow-wrap: anywhere; }
.item .actions { flex-wrap: wrap; justify-content: flex-end; max-width: 40%; }
.note-card { flex-wrap: wrap; }
.note-card > div { flex: 1 1 200px; min-width: 0; }
.note-card button.btn { margin-left: 0; }
.view-head h1 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
.btn { max-width: 100%; white-space: normal; text-align: center; }
.filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
.filters button { flex: none; }
.rk { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; letter-spacing: .04em; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: 12px; padding: 12px 14px; word-break: break-all; user-select: all; }
.install-card .emoji { font-size: 1.8rem; }
@media (max-width: 400px) {
  .tabbar a { font-size: .6rem; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .item { padding: 10px 10px; gap: 8px; }
  .item .actions { max-width: 30%; }
  .item .actions button { padding: 4px; }
  .card { padding: 14px; }
  .clocks { grid-template-columns: 1fr 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}
