:root {
  --bg: #f3f6fc; --ink: #0a1f44; --muted: #46567a; --sidebar-bg: #003399; --sidebar-text: #fff;
  --sidebar-muted: #a9c2ef; --card: #ffffff; --week: #dbe6ff; --toast-bg: #0a1f44; --ok-bg: #d9f2e3; --accent: #ffcc00; --accent-text: #0a1f44; --border: #c9d6ec; --ok: #1a8f4a;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); height: 100vh; overflow: hidden; background: var(--bg); }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; color: var(--ink); }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* Giriş */
.login-screen { position: fixed; inset: 0; background: var(--sidebar-bg); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.login-box { background: var(--card); border-radius: 14px; padding: 28px; max-width: 400px; width: 100%; display: flex; flex-direction: column; gap: 12px; position: relative; }
.login-box h1 { font-size: 1.4rem; }
.login-box p { font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.login-box input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.login-box button#login-btn { padding: 11px; border: none; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 0.95rem; }
.login-error { color: #c0272d !important; min-height: 1.2em; }
.login-lang { align-self: flex-end; }

/* İskelet */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.top-nav { display: flex; gap: 4px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; }
.top-nav::-webkit-scrollbar { height: 0; }
.nav-tab { background: none; border: none; padding: 8px 12px; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav-tab:hover { background: var(--bg); }
.nav-tab.active { background: var(--sidebar-bg); color: #fff; }
.tab-rename { border: 1px solid var(--accent); border-radius: 4px; padding: 2px 6px; font-size: 0.85rem; width: 150px; }
.app { display: flex; flex: 1; min-height: 0; }
.status-bar { display: flex; align-items: center; gap: 12px; padding: 4px 14px; background: var(--card); border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); flex-shrink: 0; }
.status-bar button { background: none; border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; font-size: 0.75rem; color: var(--muted); }

/* Sol menü */
.sidebar { width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; min-height: 0; }
.widget { padding: 14px; border-bottom: 1px solid rgba(255,255,255,.15); }
.widget-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.clock { font-size: 1.6rem; font-weight: 600; }
.lang-toggle { display: flex; gap: 2px; background: rgba(255,255,255,.15); border-radius: 6px; padding: 2px; }
.login-lang { background: var(--bg); }
.lang-btn { background: none; border: none; padding: 3px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; color: var(--sidebar-muted); }
.login-lang .lang-btn { color: var(--muted); }
.lang-btn.active { background: var(--accent); color: var(--accent-text); }
.calendar-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.cal-nav { background: none; border: none; color: #fff; font-size: 1.2rem; padding: 0 8px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 0.72rem; }
.cal-day-label { color: var(--sidebar-muted); padding: 3px 0; }
.cal-day { padding: 5px 0; border-radius: 5px; cursor: pointer; position: relative; }
.cal-day:not(.empty):hover { background: rgba(255,255,255,.18); }
.cal-day.today { outline: 1px solid var(--accent); }
.cal-day.selected-day { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.cal-day.has-note::after { content: ''; position: absolute; bottom: 1px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.cal-day.selected-day.has-note::after { background: var(--sidebar-bg); }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 6px; }
.sidebar-header h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--sidebar-muted); }
.sidebar-header button { background: var(--accent); color: var(--accent-text); border: none; width: 24px; height: 24px; border-radius: 6px; font-size: 1.1rem; font-weight: 600; }
.note-list, .howto-list { list-style: none; overflow-y: auto; flex: 1; padding: 4px 8px 12px; }
.note-list li { padding: 8px 10px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-list li:hover { background: rgba(255,255,255,.12); }
.note-list li.active { background: rgba(255,255,255,.22); font-weight: 600; }

/* İçerik */
.content { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 26px 40px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.note-title { flex: 1; min-width: 180px; font-size: 1.5rem; font-weight: 600; border: none; background: transparent; outline: none; padding: 4px 0; }
.view-head h2 { font-size: 1.25rem; min-width: 190px; text-align: center; }
.cal-nav-lg, .today-btn, .icon-btn { background: var(--card); border: 1px solid var(--border); border-radius: 7px; padding: 5px 12px; font-size: 1rem; color: var(--ink); }
.today-btn { font-size: 0.8rem; }
.icon-btn { padding: 3px 8px; font-size: 0.8rem; }
.pdf-btn { background: var(--sidebar-bg); color: #fff; border: none; border-radius: 7px; padding: 7px 13px; font-size: 0.8rem; font-weight: 600; }
.remind { display: flex; align-items: center; gap: 6px; }
.remind input { border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 0.8rem; background: var(--card); }
.section-title { font-size: 1.1rem; margin: 28px 0 10px; }

.ql-toolbar.ql-snow { background: var(--card); border: 1px solid var(--border) !important; border-radius: 8px 8px 0 0; }
.ql-container.ql-snow { background: var(--card); border: 1px solid var(--border) !important; border-top: none !important; border-radius: 0 0 8px 8px; font-family: inherit; font-size: 0.98rem; }
.ql-editor { min-height: 55vh; line-height: 1.6; }
#editor-yearly .ql-editor { min-height: 220px; }

/* Yıl görünümü */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.mini-month { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.mini-month-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.mini-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; font-size: 0.72rem; }
.mini-day-label { color: var(--muted); }
.mini-day { padding: 4px 0; border-radius: 4px; cursor: pointer; }
.mini-day:hover { background: var(--bg); }
.mini-day.today { background: var(--accent); font-weight: 600; }
.mini-day.has-note { color: #fff; background: var(--sidebar-bg); }
.mini-day.today.has-note { color: var(--accent-text); background: var(--accent); box-shadow: inset 0 0 0 2px var(--sidebar-bg); }

/* Aylık görevler (yıllık plan) */
.monthly-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.month-task-section { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.month-task-header { font-weight: 600; margin-bottom: 6px; }
.month-task-list, .task-list { list-style: none; }
.month-task-list li, .task-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.88rem; }
.month-task-list li span, .task-list li span { flex: 1; }
.month-task-list li.done span, .task-list.done li span { text-decoration: line-through; color: var(--muted); }
.task-list li.empty { color: var(--muted); font-size: 0.82rem; }
.task-delete { background: none; border: none; color: var(--muted); font-size: 1.1rem; opacity: .5; }
li:hover > .task-delete { opacity: 1; }
.month-task-add, .task-input { width: 100%; border: 1px dashed var(--border); border-radius: 6px; padding: 6px 8px; font-size: 0.85rem; margin-top: 6px; background: transparent; }

/* Nasıl yapılır */
.howto-layout { display: flex; gap: 18px; align-items: flex-start; }
.howto-side { width: 220px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sidebar-header.dark h2 { color: var(--muted); }
.howto-list { padding: 4px 8px 10px; max-height: 65vh; }
.howto-list li { padding: 8px 10px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; }
.howto-list li:hover { background: var(--bg); }
.howto-list li.active { background: var(--sidebar-bg); color: #fff; }
.howto-main { flex: 1; min-width: 0; }

/* Görevler */
.tasks-layout { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.tasks-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; flex: 1.3; min-width: 320px; }
.tcal-label { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 4px 0; }
.tcal-day { background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-height: 64px; padding: 5px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.tcal-day:hover { border-color: var(--sidebar-bg); }
.tcal-day.today .num { background: var(--accent); border-radius: 50%; padding: 0 5px; }
.tcal-day.selected { border: 2px solid var(--sidebar-bg); }
.tcal-day .num { font-size: 0.8rem; font-weight: 600; align-self: flex-start; }
.badge { font-size: 0.68rem; border-radius: 10px; padding: 0 6px; align-self: flex-start; }
.badge.open { background: var(--accent); color: var(--accent-text); }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.tasks-panel { flex: 1; min-width: 300px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.tasks-panel h3 { font-size: 1.05rem; }
.tasks-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.tasks-cols h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }

/* Menü, toast, uyarı */
.context-menu { position: fixed; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 100; min-width: 180px; padding: 4px; }
.context-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 12px; font-size: 0.88rem; border-radius: 5px; }
.context-menu button:hover { background: var(--bg); }
.toast { position: fixed; bottom: 46px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: #fff; padding: 10px 16px; border-radius: 8px; display: flex; gap: 14px; align-items: center; z-index: 100; font-size: 0.88rem; }
.toast button { background: none; border: none; color: var(--accent); font-weight: 600; }
.alarm-banner { position: fixed; top: 60px; right: 20px; background: var(--accent); color: var(--accent-text); padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); display: flex; gap: 14px; align-items: center; z-index: 100; font-weight: 600; }
.alarm-banner button { background: none; border: none; font-size: 1rem; }

/* PDF sayfası (ekranın arkasında oluşturulur) */
.pdf-sheet { position: fixed; left: 0; top: 0; z-index: -1; width: 720px; background: #fff; color: #000; padding: 8px; }
.pdf-sheet h1 { font-size: 1.6rem; margin-bottom: 14px; }
.pdf-sheet .ql-editor { min-height: 0; padding: 0; height: auto; overflow: visible; }
.pdf-sheet ul { margin: 4px 0 10px 22px; }

.top-bar { display: flex; align-items: center; background: var(--card); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.top-bar .top-nav { flex: 1; min-width: 0; border-bottom: none; }
.side-toggle { display: none; background: none; border: none; font-size: 1.4rem; padding: 6px 12px; color: var(--ink); }
.side-backdrop { display: none; }
@media (max-width: 800px) {
  .side-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 330px); z-index: 60; transform: translateX(-102%); transition: transform .22s ease; overflow-y: auto; padding-top: env(safe-area-inset-top); }
  .sidebar.open { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .note-list { max-height: none; }
  .view-head h2 { min-width: 0; }
  .note-title { font-size: 1.25rem; }
  .ql-editor { min-height: 42vh; }
  .status-bar { flex-wrap: wrap; gap: 4px 8px; padding: 4px 10px calc(4px + env(safe-area-inset-bottom)); }
  #user-email { display: none; }
  .plan-cal { position: static; }
  .app { flex-direction: column; }
  .content { padding: 14px; }
  .howto-layout { flex-direction: column; }
  .howto-side { width: 100%; }
  .tasks-cols { grid-template-columns: 1fr; }
}

/* Mobil uygulama: çentik / ana ekran çubuğu güvenli alanları */
body { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.status-bar { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
.login-screen { padding-top: calc(16px + env(safe-area-inset-top)); }
.legal-link { color: var(--muted); font-size: 0.75rem; text-decoration: underline; }
.login-box .legal-link { align-self: center; }
#delete-account-btn { color: #c0272d; border-color: #e6b4b6; }
.dialog { border: none; border-radius: 12px; padding: 22px; max-width: 380px; width: calc(100% - 32px); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog h3 { margin-bottom: 8px; }
.dialog p { font-size: 0.88rem; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.dialog input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.dialog-actions button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); font-size: 0.88rem; }
.dialog-actions .danger { background: #c0272d; border-color: #c0272d; color: #fff; font-weight: 600; }

/* Plan sekmelerinde takvim */
.plan-layout { display: flex; gap: 18px; align-items: flex-start; }
.plan-main { flex: 1; min-width: 0; }
.plan-cal { width: 290px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; position: sticky; top: 0; }
.plan-cal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; }
.plan-cal .mini-month { border: none; padding: 0; }
.plan-cal .mini-month-grid { font-size: 0.82rem; gap: 2px; }
.plan-cal .mini-day { padding: 7px 0; }
.year-cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.year-cal-head h3 { font-size: 1.05rem; min-width: 150px; text-align: center; }
.cal-hint { color: var(--muted); font-size: 0.85rem; margin: -4px 0 10px; }
.mini-month-title.clickable { cursor: pointer; }
.mini-month-title.clickable:hover { color: var(--sidebar-bg); text-decoration: underline; }
/* takvim işaretleri */
.mini-day.has-plan { box-shadow: inset 0 -3px 0 var(--accent); font-weight: 600; }
.mini-day.sel { background: var(--sidebar-bg); color: #fff; }
.mini-day.in-week { background: var(--week); }
.mini-day.in-week:first-of-type { border-radius: 4px 0 0 4px; }
.mini-day.erasmus-day { background: #1a5fd0; color: #fff; font-weight: 600; }
.mini-day.today.erasmus-day { box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 900px) {
  .plan-layout { flex-direction: column-reverse; }
  .plan-cal { width: 100%; position: static; }
}

/* Koyu tema: sistemi izler, alt çubuktaki düğmeyle elle değiştirilebilir */
:root[data-theme="dark"] { color-scheme: dark; --bg: #0e1526; --ink: #e8edf7; --muted: #a9b6d3; --border: #2a3a5e; --card: #162038; --week: #22335c; --toast-bg: #2a3a5e; --ok-bg: #16402b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #0e1526; --ink: #e8edf7; --muted: #a9b6d3; --border: #2a3a5e; --card: #162038; --week: #22335c; --toast-bg: #2a3a5e; --ok-bg: #16402b; }
}
.ql-snow .ql-stroke { stroke: var(--ink); }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: var(--ink); }
.ql-snow .ql-picker, .ql-snow .ql-picker-label { color: var(--ink); }
.ql-editor { color: var(--ink); }
.ql-editor.ql-blank::before { color: var(--muted); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: #4d7cff; }
.note-title, .task-input, .month-task-add, .tab-rename { color: var(--ink); }
.pdf-sheet { --card: #fff; --ink: #0a1f44; --muted: #46567a; --border: #c9d6ec; --bg: #f3f6fc; --week: #dbe6ff; }
.pdf-sheet .ql-editor { color: #000; }
.pdf-sheet .ql-snow .ql-stroke { stroke: #000; }
.dialog { background: var(--card); color: var(--ink); }

/* Giriş ekranı: kayıt / şifremi unuttum */
.login-box { background: var(--card); color: var(--ink); }
.login-box input { background: var(--card); color: var(--ink); }
.login-heading { font-size: 1.05rem; margin: 2px 0 -4px; }
.login-info { color: #1a8f4a !important; min-height: 1.2em; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.82rem; }
.login-links a { color: var(--sidebar-bg); }
:root[data-theme="dark"] .login-links a { color: #7ea2ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login-links a { color: #7ea2ff; } }

/* Arama, menü düğmeleri, sekme ayarı */
.note-search { margin: 4px 12px 6px; padding: 7px 10px; border-radius: 8px; border: none; font-size: 0.85rem; background: rgba(255,255,255,.16); color: #fff; width: calc(100% - 24px); }
.note-search::placeholder { color: var(--sidebar-muted); }
.note-list li.empty { color: var(--sidebar-muted); cursor: default; }
.menu-btn { font-size: 1.1rem; line-height: 1; padding: 4px 10px; }
.nav-more { flex-shrink: 0; }
.tabs-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 4px; }
.tabs-row { display: flex; align-items: center; gap: 6px; padding: 6px 4px; font-size: 0.92rem; cursor: pointer; }
.tabs-row input { width: auto; }
.status-bar #theme-btn { padding: 1px 6px; }
/* Dokunmatikte uzun basma menüsü metin seçimini ya da sistem menüsünü tetiklemesin */
.nav-tab, .note-list li, .howto-list li { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* Abonelik ekranı */
.paywall { position: fixed; inset: 0; z-index: 80; background: linear-gradient(160deg, #0b3fb8, #002273); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.paywall-box { background: var(--card); color: var(--ink); border-radius: 16px; padding: 26px 22px; max-width: 420px; width: 100%; text-align: center; margin: auto; }
.paywall-icon { font-size: 2.6rem; }
.paywall-box h1 { font-size: 1.35rem; margin: 6px 0; }
.pw-sub { color: var(--muted); font-size: 0.9rem; line-height: 1.5; margin-bottom: 10px; }
.pw-list { list-style: none; text-align: left; font-size: 0.92rem; line-height: 1.9; margin: 8px auto 14px; max-width: 320px; }
.pw-price { font-size: 1.15rem; font-weight: 700; margin: 6px 0 10px; }
.pw-buy { width: 100%; padding: 13px; border: none; border-radius: 10px; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 1rem; }
.pw-buy:disabled { opacity: .55; }
.pw-link { background: none; border: none; color: var(--muted); text-decoration: underline; font-size: 0.82rem; padding: 6px 4px; }
.pw-fine { color: var(--muted); font-size: 0.72rem; line-height: 1.5; margin-top: 8px; }
.pw-webmsg { color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin-bottom: 12px; }
.pw-foot { margin-top: 14px; font-size: 0.78rem; color: var(--muted); line-height: 2; }
.pw-foot a { color: var(--muted); }
