:root {
  --brand: #0f6cbd; --brand-dark: #0b5a9d; --brand-weak: #e6f0fa; --brand-sel: #d6e7f7; --on-brand: #ffffff;
  --topbar: #0f548c; --topbar-text: #ffffff;
  --bg: #f3f2f1; --panel: #ffffff; --panel2: #faf9f8; --line: #e1dfdd; --line2: #edebe9;
  --text: #242424; --muted: #616161; --subtle: #8a8886;
  --danger: #c50f1f; --flag: #d13438; --shadow: 0 8px 28px rgba(0,0,0,.22);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1a19; --panel: #252423; --panel2: #201f1e; --line: #3b3a39; --line2: #323130;
  --text: #f3f2f1; --muted: #c8c6c4; --subtle: #979593;
  --danger: #f1707b; --flag: #f1707b; --shadow: 0 8px 28px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
svg.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
input, textarea, select { font: inherit; color: var(--text); }
::selection { background: var(--brand-sel); }

/* ---------- Ortak bileşenler ---------- */
.btn-primary { background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand); border-radius: 4px; padding: 8px 18px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 16px; }
.btn-sec:hover { background: var(--panel2); border-color: var(--subtle); }
.btn-danger { background: var(--danger); border: 1px solid var(--danger); color: #fff; border-radius: 4px; padding: 8px 16px; font-weight: 600; }
.iconbtn { background: transparent; border: 0; color: inherit; width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; }
.iconbtn:hover { background: rgba(127,127,127,.18); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .tinput { width: 100%; border: 1px solid var(--line); border-bottom: 2px solid var(--subtle); border-radius: 4px; padding: 9px 11px; background: var(--panel); }
.field input:focus, .field select:focus, .tinput:focus { outline: none; border-bottom-color: var(--brand); }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.err { color: var(--danger); min-height: 1.3em; margin-top: 12px; font-size: 13px; }

/* ---------- Giriş ---------- */
#login { height: 100%; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, var(--topbar) 0%, var(--brand) 100%); }
.lcard { background: var(--panel); border-radius: 10px; padding: 36px 36px 30px; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.lcard .logo { width: 46px; height: 46px; border-radius: 10px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; margin-bottom: 18px; }
.lcard .logo svg { width: 26px; height: 26px; }
.lcard h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; }
.lcard p { margin: 0 0 22px; color: var(--muted); }
.lcard .btn-primary { width: 100%; padding: 11px; margin-top: 6px; justify-content: center; }
.lfoot { margin-top: 14px; font-size: 12px; color: var(--subtle); text-align: center; }

/* ---------- İskelet ---------- */
#app { height: 100%; display: grid; grid-template-rows: 48px auto 1fr; }
#topbar { background: var(--topbar); color: var(--topbar-text); display: flex; align-items: center; gap: 14px; padding: 0 12px; }
#topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; min-width: 190px; }
#topbar .brand .logo { width: 26px; height: 26px; border-radius: 6px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
#topbar .brand svg { width: 16px; height: 16px; }
#searchForm { flex: 1; max-width: 560px; margin: 0 auto; position: relative; }
#searchForm svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .8; width: 16px; height: 16px; }
#q { width: 100%; height: 32px; border: 0; border-radius: 6px; padding: 0 12px 0 34px; background: rgba(255,255,255,.16); color: #fff; }
#q::placeholder { color: rgba(255,255,255,.75); }
#q:focus { outline: none; background: #fff; color: #242424; }
#q:focus::placeholder { color: #8a8886; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; position: relative; }
#topbar .iconbtn:hover { background: rgba(255,255,255,.16); }
#avatarBtn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: var(--brand); color: var(--on-brand); font-weight: 600; font-size: 12px; }
#userMenu { position: absolute; top: 42px; right: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 260px; z-index: 30; padding: 6px; }
#userMenu .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; word-break: break-all; display: flex; gap: 10px; align-items: center; }
#userMenu .who b { display: block; font-weight: 600; }
#userMenu .who small { color: var(--muted); }
#userMenu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 12px; border-radius: 4px; }
#userMenu button:hover { background: var(--panel2); }

/* Araç şeridi */
#ribbon { background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 2px; padding: 6px 10px; overflow-x: auto; white-space: nowrap; }
.rbtn { background: transparent; border: 0; border-radius: 4px; padding: 6px 10px; display: inline-flex; gap: 7px; align-items: center; color: var(--text); }
.rbtn:hover:not(:disabled) { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); }
.rbtn:disabled { opacity: .4; cursor: default; }
.rbtn svg { color: var(--brand); }
.rbtn.new { background: var(--brand); color: var(--on-brand); font-weight: 600; margin-right: 8px; padding: 7px 14px; }
.rbtn.new svg { color: var(--on-brand); }
.rbtn.new:hover { background: var(--brand-dark); box-shadow: none; }
.rbtn.del svg { color: var(--danger); }
.rbtn.flagged svg { color: var(--flag); fill: var(--flag); }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: none; }

#main { --side-w: 220px; --list-w: 380px; display: grid; grid-template-columns: var(--side-w) 5px var(--list-w) 5px minmax(0, 1fr); min-height: 0; }
#main.list-wide { grid-template-columns: var(--side-w) 5px minmax(0, 1fr); }
#main.list-wide #split2, #main.list-wide #reader { display: none; }
.split { cursor: col-resize; position: relative; background: var(--panel2); touch-action: none; outline: none; }
.split::after { content: ""; position: absolute; left: 2px; top: 0; bottom: 0; width: 1px; background: var(--line); transition: background .12s, width .12s, left .12s; }
.split:hover::after, .split.drag::after, .split:focus-visible::after { left: 1px; width: 3px; background: var(--brand); }
body.resizing { user-select: none; cursor: col-resize; }
body.resizing iframe { pointer-events: none; }

/* Klasörler */
#side { background: var(--panel2); overflow: auto; overflow-x: hidden; padding: 4px 6px 8px; min-width: 0; }
.shead { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 4px 10px; margin-bottom: 2px; }
.shead span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); font-weight: 600; white-space: nowrap; overflow: hidden; }
.shead .iconbtn { width: 30px; height: 30px; color: var(--muted); }
#side.collapsed { padding: 4px 4px 8px; }
#side.collapsed .shead { justify-content: center; padding: 4px 0; }
#side.collapsed .shead span, #side.collapsed .fname { display: none; }
#side.collapsed .folder { justify-content: center; padding: 10px 0; }
#side.collapsed .folder.active::before { top: 9px; bottom: 9px; }
#side.collapsed .cnt { position: absolute; top: 2px; right: 3px; font-size: 10px; line-height: 14px; min-width: 14px; padding: 0 4px; text-align: center; background: var(--brand); color: var(--on-brand); border-radius: 8px; }
.folder { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; cursor: pointer; position: relative; }
.folder:hover { background: var(--line2); }
.folder.active { background: var(--brand-sel); font-weight: 600; }
.folder.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--brand); }
.folder .fname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder .cnt { font-size: 12px; color: var(--brand); font-weight: 600; }
.folder svg { color: var(--muted); }
.folder.active svg { color: var(--brand); }

/* Liste */
#listPane { background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#listHead { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; }
#listHead h3 { margin: 0; font-size: 18px; font-weight: 600; }
#listCount { color: var(--subtle); font-size: 12px; }
#tabs { display: flex; gap: 4px; padding: 4px 10px 6px; border-bottom: 1px solid var(--line); }
.tab { background: transparent; border: 0; border-radius: 4px; padding: 5px 10px; color: var(--muted); position: relative; }
.tab:hover { background: var(--panel2); }
.tab.active { color: var(--brand); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -7px; height: 2px; background: var(--brand); border-radius: 2px; }
#list { flex: 1; overflow: auto; }
.grp { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--muted); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av from date" "av subj subj"; gap: 0 10px; padding: 9px 12px 9px 14px; border-bottom: 1px solid var(--line2); cursor: pointer; position: relative; }
.item .av { grid-area: av; align-self: center; }
.item .from { grid-area: from; }
.item .subj { grid-area: subj; }
.item .date { grid-area: date; }
.item .size { grid-area: size; display: none; font-size: 12px; color: var(--subtle); text-align: right; white-space: nowrap; }
.item .d-l { display: none; }
#listCols { display: none; padding: 6px 12px 6px 14px; gap: 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--panel2); }
#listCols .c-size { text-align: right; } #listCols .c-date { text-align: right; }
#main.list-wide #listCols, #main.list-wide .item { grid-template-columns: 36px minmax(140px, 260px) minmax(0, 1fr) 76px 190px; }
#main.list-wide #listCols { display: grid; }
#main.list-wide .item { grid-template-areas: "av from subj size date"; align-items: center; }
#main.list-wide .item .size { display: block; }
#main.list-wide .item .d-s { display: none; }
#main.list-wide .item .d-l { display: inline; }
#main.list-wide .item .subj { font-size: 14px; }
body.compact #main.list-wide .item, body.compact #main.list-wide #listCols { grid-template-columns: 26px minmax(140px, 260px) minmax(0, 1fr) 76px 190px; }
.item:hover { background: var(--panel2); }
.item.active { background: var(--brand-sel); }
.item.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 13px; flex: none; }
.item .from { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 13px; }
.item .date { font-size: 12px; color: var(--subtle); white-space: nowrap; display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.item .date svg { width: 13px; height: 13px; color: var(--flag); fill: var(--flag); }
.item .date svg.clip { color: var(--subtle); fill: none; }
.rbtn.on { background: var(--brand-sel); }
.item.unread .from { font-weight: 700; }
.item.unread .subj { color: var(--brand); font-weight: 600; }
.item.unread .date { color: var(--brand); font-weight: 600; }
body.compact .item { padding: 5px 12px 5px 14px; grid-template-columns: 30px 1fr auto; }
body.compact .item .av { width: 26px; height: 26px; font-size: 10px; }
body.compact .grp { padding: 6px 14px 2px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; stroke-width: 1.2; opacity: .5; display: block; margin: 0 auto 10px; }
#pager { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#pager button { background: transparent; border: 0; border-radius: 4px; padding: 4px 10px; color: var(--brand); }
#pager button:hover:not(:disabled) { background: var(--panel2); }
#pager button:disabled { color: var(--subtle); cursor: default; }

/* Okuma paneli */
#reader { position: relative; background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#placeholder { margin: auto; text-align: center; color: var(--subtle); }
#placeholder svg { width: 72px; height: 72px; stroke-width: .9; margin-bottom: 8px; }
#msgView { display: none; flex-direction: column; flex: 1; min-height: 0; }
#msgView.on { display: flex; }
#closeReader { position: absolute; top: 10px; right: 10px; z-index: 3; color: var(--muted); }
#readerHead { padding: 18px 56px 14px 24px; border-bottom: 1px solid var(--line); }
#mSubject { margin: 0 0 14px; font-size: 20px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.sender { display: flex; gap: 12px; align-items: flex-start; }
.sender .av { width: 44px; height: 44px; font-size: 15px; }
.sinfo { flex: 1; min-width: 0; }
.sname { font-weight: 600; }
.saddr { color: var(--muted); font-size: 13px; word-break: break-all; }
.sdate { color: var(--subtle); font-size: 12px; white-space: nowrap; }
.details { margin-top: 6px; font-size: 13px; color: var(--muted); }
.details a { color: var(--brand); cursor: pointer; }
.details .drow { margin-top: 3px; word-break: break-word; }
.details .drow b { color: var(--text); font-weight: 600; margin-right: 4px; }
.bar { padding: 8px 24px; font-size: 13px; display: flex; gap: 12px; align-items: center; background: #fff4ce; color: #3b2e00; border-bottom: 1px solid #f0dc9a; }
:root[data-theme="dark"] .bar { background: #433519; color: #fde7a0; border-color: #5c4a22; }
.bar button.link { background: transparent; border: 0; color: var(--brand); padding: 0; text-decoration: underline; }
.bar .btn-primary { padding: 4px 12px; margin-left: auto; }
#body { flex: 1; min-height: 0; position: relative; }
#body iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
#body pre { margin: 0; padding: 20px 24px; white-space: pre-wrap; word-break: break-word; font: inherit; overflow: auto; height: 100%; }
#atts { padding: 10px 24px 12px; border-top: 1px solid var(--line); background: var(--panel2); }
#atts .ttl { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
#atts .list { display: flex; flex-wrap: wrap; gap: 8px; }
#atts a { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; background: var(--panel); color: var(--text); text-decoration: none; font-size: 13px; }
#atts a:hover { border-color: var(--brand); }
#atts a small { color: var(--subtle); }
#atts a svg { color: var(--brand); width: 16px; height: 16px; }

/* Hızlı yanıt */
#qr { border-top: 1px solid var(--line); background: var(--panel2); padding: 10px 24px 12px; }
#qrOpen { width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; color: var(--subtle); display: flex; gap: 10px; align-items: center; }
#qrOpen:hover { border-color: var(--brand); color: var(--text); }
#qrBox { background: var(--panel); border: 1px solid var(--brand); border-radius: 6px; overflow: hidden; }
#qrTo { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line2); }
#qrTo .av { width: 22px; height: 22px; font-size: 9px; }
#qrText { width: 100%; border: 0; resize: vertical; min-height: 78px; max-height: 240px; padding: 10px 12px; background: transparent; display: block; }
#qrText:focus { outline: none; }
#qrFoot { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-top: 1px solid var(--line2); flex-wrap: wrap; }
#qrFoot label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
#qrFoot .grow { flex: 1; }
#qrFoot .linkbtn { background: transparent; border: 0; color: var(--brand); padding: 4px 6px; }

/* ---------- Yazma ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 14px; z-index: 40; }
#composeBox { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 860px; height: min(760px, 96vh); display: flex; flex-direction: column; overflow: hidden; position: relative; }
#composeBox .chead { background: var(--topbar); color: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
#composeBox .chead .iconbtn:hover { background: rgba(255,255,255,.2); }
.ctools { display: flex; align-items: center; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: relative; }
.ctools .btn-primary { padding: 7px 18px; margin-right: 8px; }
.fbtn { background: transparent; border: 0; border-radius: 4px; min-width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0 6px; position: relative; }
.fbtn:hover { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); }
.fbtn.on { background: var(--brand-sel); color: var(--brand); }
.fbtn.b { font-weight: 700; } .fbtn.i { font-style: italic; } .fbtn.u { text-decoration: underline; }
#colorMenu { position: absolute; top: 40px; left: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 8px; display: grid; grid-template-columns: repeat(5, 22px); gap: 6px; z-index: 5; }
#colorMenu button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.crow { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line2); position: relative; }
.crow label, .crow .lbl { width: 50px; color: var(--muted); font-size: 13px; flex: none; }
.crow input { flex: 1; border: 0; background: transparent; padding: 10px 0; min-width: 0; }
.crow input:focus { outline: none; }
.crow .fromv { padding: 10px 0; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .links { display: flex; gap: 10px; font-size: 13px; }
.crow .links a { color: var(--brand); cursor: pointer; }
.sugg { position: absolute; top: 100%; left: 66px; right: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 8; overflow: hidden; }
.sugg div { padding: 7px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.sugg div.sel, .sugg div:hover { background: var(--brand-sel); }
.sugg .av { width: 26px; height: 26px; font-size: 10px; }
.sugg small { color: var(--muted); display: block; line-height: 1.1; }
#cEditor { flex: 1; overflow: auto; padding: 14px 18px; outline: none; line-height: 1.55; min-height: 120px; }
#cEditor blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
#cEditor a { color: var(--brand); }
#cAtts { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px; border-top: 1px solid var(--line2); background: var(--panel2); align-items: center; }
#cAtts:empty { display: none; }
.chip { display: inline-flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; font-size: 12px; max-width: 260px; }
.chip svg { color: var(--brand); width: 15px; height: 15px; }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--subtle); }
.chip i { cursor: pointer; font-style: normal; color: var(--subtle); }
.chip i:hover { color: var(--danger); }
.meter { flex-basis: 100%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.meter.warn > span { background: var(--danger); }
#cStatus { padding: 8px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line2); min-height: 34px; display: flex; align-items: center; gap: 12px; }
#cStatus.err { color: var(--danger); }
#cStatus .meter { flex: 1; max-width: 240px; }
#dropOverlay { position: absolute; inset: 0; z-index: 10; background: color-mix(in srgb, var(--brand) 14%, var(--panel)); border: 2px dashed var(--brand); border-radius: 10px; display: grid; place-items: center; color: var(--brand); font-size: 16px; font-weight: 600; pointer-events: none; }
#dropOverlay svg { width: 34px; height: 34px; display: block; margin: 0 auto 8px; }

/* Pencereler */
#dlg { z-index: 70; }
#dlgBox { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 420px; padding: 22px; }
#dlgBox h3 { margin: 0 0 8px; font-size: 17px; }
#dlgBox p { margin: 0 0 18px; color: var(--muted); }
#dlgBtns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#moveMenu { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 220px; max-height: 60vh; overflow: auto; z-index: 35; padding: 6px; }
#moveMenu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 12px; border-radius: 4px; }
#moveMenu button:hover { background: var(--panel2); }
#moveMenu button svg { color: var(--muted); }
#moveMenu .mt { padding: 6px 12px; font-size: 11px; text-transform: uppercase; color: var(--subtle); letter-spacing: .05em; }

/* Ayarlar */
#settings { z-index: 50; }
#settingsBox { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 760px; height: min(600px, 94vh); display: grid; grid-template-columns: 190px 1fr; grid-template-rows: 1fr auto; overflow: hidden; }
#sTabs { background: var(--panel2); border-right: 1px solid var(--line); padding: 14px 8px; grid-row: 1 / span 2; }
#sTabs h3 { margin: 4px 10px 12px; font-size: 16px; }
.stab { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 10px; border-radius: 4px; position: relative; }
.stab:hover { background: var(--line2); }
.stab.active { background: var(--brand-sel); font-weight: 600; }
.stab.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--brand); }
.stab svg { color: var(--muted); }
.stab.active svg { color: var(--brand); }
#sBody { overflow: auto; padding: 22px 26px; }
#sBody h4 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.sec { margin-bottom: 22px; }
.sec > label.t { display: block; font-weight: 600; margin-bottom: 8px; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.profile-head .av { width: 56px; height: 56px; font-size: 20px; }
.profile-head b { display: block; font-size: 16px; }
.profile-head span { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; padding: 7px 16px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand); color: var(--on-brand); font-weight: 600; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; color: #fff; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--text); }
.sw svg { width: 16px; height: 16px; stroke-width: 2.4; }
.trow { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line2); }
.trow:last-child { border-bottom: 0; }
.trow b { display: block; font-weight: 600; }
.trow small { color: var(--muted); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--subtle); border-radius: 11px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.quota { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 8px 0 6px; }
.quota > span { display: block; height: 100%; background: var(--brand); width: 0; }
.quota.warn > span { background: var(--danger); }
#sigEditor { border: 1px solid var(--line); border-radius: 6px; min-height: 130px; padding: 12px 14px; background: var(--panel); outline: none; line-height: 1.5; }
#sigEditor:focus { border-color: var(--brand); }
#sigEditor:empty::before { content: attr(data-ph); color: var(--subtle); }
.sigtools { display: flex; gap: 2px; margin-bottom: 8px; }
#sFoot { grid-column: 2; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--line); }
#savedInd { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; opacity: 0; transition: opacity .3s; }
#savedInd.on { opacity: 1; }
#savedInd svg { color: var(--brand); width: 16px; height: 16px; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #323130; color: #fff; padding: 10px 18px; border-radius: 6px; z-index: 80; box-shadow: var(--shadow); max-width: 92vw; }

.back { display: none; }
@media (max-width: 960px) {
  #main, #main.list-wide { grid-template-columns: 1fr; }
  .split, #closeReader, #paneBtn, #sideToggle, #listCols { display: none !important; }
  #side, #listPane, #reader { grid-column: 1; grid-row: 1; }
  #main.list-wide #reader { display: flex; }
  #side.collapsed .fname, #side.collapsed .shead span { display: inline; }
  #app[data-view="folders"] #listPane, #app[data-view="folders"] #reader { display: none; }
  #app[data-view="list"] #side, #app[data-view="list"] #reader { display: none; }
  #app[data-view="read"] #side, #app[data-view="read"] #listPane { display: none; }
  .iconbtn.back { display: grid; }
  #topbar .brand span { display: none; }
  #topbar .brand { min-width: 0; }
  .rbtn .lbl { display: none; }
  .rbtn.new .lbl { display: inline; }
  #readerHead { padding: 14px 16px; }
  .bar { padding: 8px 16px; flex-wrap: wrap; }
  #atts, #qr { padding-left: 16px; padding-right: 16px; }
  #settingsBox { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  #sTabs { grid-row: 1; display: flex; gap: 4px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  #sTabs h3 { display: none; }
  .stab { width: auto; white-space: nowrap; }
  .stab.active::before { display: none; }
  #sFoot { grid-column: 1; }
  #sBody { padding: 16px; }
  .sugg { left: 16px; }
}
