/* ============ Tokens ============ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --text: #171b24;
  --text-2: #4a5263;
  --muted: #7a8293;
  --border: #e2e5eb;
  --border-strong: #cfd4dd;
  --accent: #4263eb;
  --accent-2: #364fc7;
  --accent-soft: #edf1ff;
  --accent-text: #3b5bdb;
  --opp: #2f9e44;
  --opp-soft: #e6f6ea;
  --opp-text: #237032;
  --warn: #e8590c;
  --warn-soft: #fff1e6;
  --warn-text: #b3480a;
  --bad: #e03131;
  --bad-soft: #ffeaea;
  --hot: #e8590c;
  --high: #2f9e44;
  --mid: #c08a00;
  --low: #8a92a3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 14px;
  --radius-sm: 9px;
  --topbar: #0f1729;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --surface: #131a2a;
    --surface-2: #19223a;
    --surface-3: #212c48;
    --text: #e7eaf2;
    --text-2: #b4bccd;
    --muted: #8189a0;
    --border: #232d45;
    --border-strong: #33405f;
    --accent: #6d8cff;
    --accent-2: #86a0ff;
    --accent-soft: #1c2747;
    --accent-text: #9db2ff;
    --opp: #40c057;
    --opp-soft: #14301f;
    --opp-text: #8ce99a;
    --warn: #ff922b;
    --warn-soft: #36240f;
    --warn-text: #ffc078;
    --bad: #ff6b6b;
    --bad-soft: #3a1717;
    --hot: #ff7a2b;
    --high: #37b24d;
    --mid: #d9a300;
    --low: #5c667d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
    --topbar: #080c15;
  }
}

/* ============ Temel ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
h1 { font-size: 22px; margin: 8px 0 14px; letter-spacing: -.01em; }
kbd {
  font: 11px/1 ui-monospace, Consolas, monospace; padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
.container.wide { max-width: 1240px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
.hint { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ============ Üst bar ============ */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--topbar); border-bottom: 1px solid rgba(255,255,255,.06); }
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: 0 16px; height: 54px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-inner.wide { max-width: 1240px; }
.brand { white-space: nowrap; flex: none; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { color: #7c95ff; font-size: 18px; }
.topnav { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a, .topnav form { flex: none; }
.topnav a, .topnav .link {
  color: #aab4ca; font-size: 14px; padding: 7px 11px; border-radius: 8px;
}
.topnav a:hover, .topnav .link:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.topnav a.active { color: #fff; background: rgba(255,255,255,.11); }
.link { background: none; border: 0; cursor: pointer; }

/* ============ Kontroller ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 13px; font-size: 14px; font-weight: 500;
  cursor: pointer; line-height: 1.2; transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; border-radius: 9px;
  cursor: pointer; font-size: 15px; color: var(--muted);
  transition: background .15s, border-color .15s, transform .1s, filter .15s;
  filter: grayscale(1) opacity(.6);
}
.icon-btn:hover { background: var(--surface-2); filter: none; color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { background: var(--accent-soft); border-color: var(--accent); filter: none; }

.input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 11px; font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { cursor: pointer; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.segmented button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ============ Haber düzeni ============ */
.news-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }

.sidebar { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 90px); overflow-y: auto; padding-bottom: 8px; }
.sidebar-head { display: none; }
.view-nav { display: flex; flex-direction: column; gap: 1px; }
.view-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.view-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.view-link.active { background: var(--accent-soft); color: var(--accent-text); }
.view-link.is-opps:not(.active) .view-label { color: var(--opp-text); }
.view-icon { width: 20px; text-align: center; font-size: 13px; }
.view-label { flex: 1; }
.count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
}
.view-link.active .count { background: var(--accent); color: #fff; }
.view-link.is-opps .count { background: var(--opp); color: #fff; }
.count[hidden] { display: none; }
.nav-sep { height: 1px; background: var(--border); margin: 6px 10px; }

.filter-group { display: flex; flex-direction: column; gap: 7px; }
.filter-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.filter-group .segmented { display: flex; }
.filter-group .segmented button { flex: 1; padding: 5px 4px; }
.reset-btn { align-self: flex-start; }

.news-main { min-width: 0; }
.toolbar {
  position: sticky; top: 54px; z-index: 10;
  display: flex; gap: 10px; align-items: center;
  padding: 14px 0 10px; background: var(--bg);
}
.search { position: relative; flex: 1; }
.search .input { padding-left: 34px; padding-right: 40px; height: 40px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 17px; pointer-events: none; }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search .input:focus ~ .search-kbd { display: none; }

.cat-bar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.cat-chip:hover { border-color: var(--border-strong); color: var(--text); }
.cat-chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }

.news-list { transition: opacity .15s; }
.news-list.is-loading { opacity: .45; pointer-events: none; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; font-size: 13px; min-height: 30px; }

/* ============ Kart ============ */
.card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px 12px; margin-bottom: 10px; box-shadow: var(--shadow);
  position: relative; transition: opacity .2s, transform .2s, border-color .15s;
}
.card:hover { border-color: var(--border-strong); }
.card.is-opp { border-color: color-mix(in srgb, var(--opp) 45%, var(--border)); }
.card.is-opp::before {
  content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--opp);
}
.card.is-read { opacity: .62; }
.card.is-read:hover { opacity: 1; }
.card.is-read .title a { color: var(--text-2); }
.card.is-busy { pointer-events: none; }
.card.is-leaving { opacity: 0; transform: translateX(12px); }

.score {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--text-2);
}
.s-hot { background: color-mix(in srgb, var(--hot) 16%, transparent); color: var(--hot); }
.s-high { background: color-mix(in srgb, var(--high) 16%, transparent); color: var(--high); }
.s-mid { background: color-mix(in srgb, var(--mid) 16%, transparent); color: var(--mid); }
.s-low, .s-none { background: var(--surface-2); color: var(--low); }

.card-body { min-width: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.meta-src { color: var(--muted); margin-left: 2px; }
.meta-src .lang {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong); margin-left: 3px; vertical-align: 1px;
}
.title { margin: 7px 0 4px; font-size: 16.5px; line-height: 1.38; font-weight: 650; letter-spacing: -.005em; }
.title a { color: var(--text); }
.title a:hover { color: var(--accent-text); text-decoration: none; }
.summary { margin: 0 0 8px; color: var(--text-2); }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; border: 0;
  background: var(--accent-soft); color: var(--accent-text);
}
button.chip { cursor: pointer; }
button.chip:hover { filter: brightness(1.1); }
.chip.opp { background: var(--opp-soft); color: var(--opp-text); }
.chip.deadline { background: var(--warn-soft); color: var(--warn-text); }
.chip.deadline.soon { background: var(--bad-soft); color: var(--bad); }
.chip.past { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.chip.deadline.past { text-decoration: line-through; }
.chip.muted-chip { background: var(--surface-2); color: var(--muted); }
.chip.lang { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }

.callout { font-size: 14px; border-radius: 10px; padding: 9px 12px; margin: 8px 0; background: var(--surface-2); color: var(--text-2); }
.callout-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; color: var(--muted); }
.callout.action { background: var(--opp-soft); color: var(--text); }
.callout.action .callout-label { color: var(--opp-text); }

.more { margin: 4px 0 2px; }
.more > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--accent-text); padding: 2px 0; user-select: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "›"; font-size: 17px; line-height: 1; transition: transform .15s; }
.more[open] > summary::before { transform: rotate(90deg); }
.detail { margin: 6px 0 4px; color: var(--text-2); font-size: 14.5px; }

.card-foot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 8px; font-size: 12.5px; }
.tag { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.tag:hover { color: var(--accent-text); }
.dups { color: var(--muted); }
.dups a { margin-left: 4px; }

.actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.action-group { display: flex; align-items: center; gap: 2px; }

.load-more-wrap { display: flex; justify-content: center; padding: 8px 0 24px; }
.load-more { min-width: 240px; }

.empty { text-align: center; padding: 56px 16px; }
.empty-icon { font-size: 40px; margin-bottom: 6px; }
.empty h2 { margin: 0 0 6px; font-size: 18px; }

.only-mobile { display: none; }
.sidebar-backdrop { display: none; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); color: #fff; }

/* ============ Mobil ============ */
@media (max-width: 900px) {
  .news-layout { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); max-height: none; z-index: 60;
    background: var(--surface); padding: 16px; box-shadow: var(--shadow-lg);
    transform: translateX(-105%); transition: transform .22s ease;
  }
  .sidebar-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; display: block; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .toolbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .search-kbd { display: none; }
  .topnav a, .topnav .link { padding: 6px 8px; font-size: 13px; }
}
@media (max-width: 520px) {
  .card { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .score { width: auto; height: auto; padding: 2px 9px; border-radius: 8px; font-size: 13px; justify-self: start; }
  .title { font-size: 15.5px; }
  .brand-text { display: none; }
}

/* ============ Diğer sayfalar ============ */
.login { max-width: 360px; margin: 12vh auto; background: var(--surface); padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login h1 { text-align: center; }
.login input {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 12px; font: inherit;
}
.login input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.error { color: var(--bad); font-size: 13.5px; }
.notice { background: var(--accent-soft); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
td a.small { word-break: break-all; }

.status { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--opp-soft); color: var(--opp-text); }
.status.warn { background: var(--warn-soft); color: var(--warn-text); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.off { background: var(--surface-2); color: var(--muted); }

.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .big { font-size: 18px; font-weight: 700; word-break: break-word; }
.runbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
