:root {
  --navy: #132238;
  --navy-2: #1e334f;
  --teal: #10b8a6;
  --teal-dark: #078f82;
  --mint: #e8f7f5;
  --cream: #f6f7f4;
  --white: #ffffff;
  --text: #172b3a;
  --muted: #687784;
  --line: #dfe7ec;
  --danger: #c54444;
  --warning: #b7791f;
  --shadow: 0 16px 44px rgba(19, 34, 56, .08);
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; color: var(--text); background: var(--cream); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.topbar { height: 76px; padding: 0 4vw; display: flex; align-items: center; gap: 36px; background: var(--navy); color: var(--white); position: sticky; top: 0; z-index: 20; box-shadow: 0 8px 24px rgba(7, 21, 37, .16); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 215px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--navy); background: var(--teal); font-weight: 900; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: #aebdca; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
nav { display: flex; align-items: stretch; gap: 6px; height: 100%; }
nav a { display: flex; align-items: center; padding: 0 14px; color: #bac7d2; text-decoration: none; font-size: 14px; border-bottom: 3px solid transparent; }
nav a:hover, nav a.active { color: var(--white); border-color: var(--teal); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #c8d2dc; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #6ee7b7; box-shadow: 0 0 0 4px rgba(110, 231, 183, .12); }
.status.working i { background: #fbbf24; animation: blink 1.2s infinite; }
.icon-button { border: 1px solid #3a4d64; background: transparent; color: #c8d2dc; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; }

.shell { width: min(1480px, 92vw); margin: 42px auto 70px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 20%, #1e4560 0, var(--navy) 42%, #0c1828 100%); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.eyebrow { display: block; color: var(--teal-dark); font-size: 11px; font-weight: 800; letter-spacing: .16em; margin-bottom: 8px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 42px); line-height: 1.08; letter-spacing: -.035em; color: var(--navy); }
h2 { margin-bottom: 5px; font-size: 18px; color: var(--navy); }
.page-head p, .panel-head p, .section-title p { color: var(--muted); margin-bottom: 0; font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: 11px 16px; min-height: 42px; text-decoration: none; font-weight: 750; font-size: 13px; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { background: var(--teal); color: #082925; box-shadow: 0 8px 20px rgba(16, 184, 166, .2); }
.button.primary:hover { background: #1cc9b6; }
.button.ghost { background: var(--white); color: var(--navy); border: 1px solid var(--line); }
.button.wide { width: 100%; }
.text-link { display: inline-block; margin-top: 16px; color: var(--teal-dark); font-weight: 750; text-decoration: none; font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-grid.four { grid-template-columns: repeat(4, 1fr); }
.metric { position: relative; padding: 19px 18px; border-radius: 16px; background: var(--white); border: 1px solid var(--line); box-shadow: 0 7px 24px rgba(19, 34, 56, .045); overflow: hidden; }
.metric:before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #b8c5ce; }
.metric.positive:before { background: var(--teal); }
.metric.sourcing:before { background: #5b8def; }
.metric.watch:before { background: #f0b849; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric span { font-size: 12px; }
.metric strong { display: block; margin: 8px 0 2px; color: var(--navy); font-size: 28px; letter-spacing: -.04em; }
.metric small { font-size: 11px; }

.content-grid { display: grid; grid-template-columns: 1fr 360px; gap: 22px; margin-bottom: 22px; }
.content-grid.wide-left { grid-template-columns: minmax(0, 1fr) 350px; }
.stack { display: grid; align-content: start; gap: 22px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.panel.compact { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px 18px; }
.panel.compact .panel-head { padding: 0 0 18px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 15px; background: #f1f5f6; color: #5d6b77; text-align: left; white-space: nowrap; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
td { padding: 13px 15px; border-top: 1px solid #edf1f3; vertical-align: middle; }
tbody tr:hover { background: #fbfdfd; }
.product-cell { min-width: 230px; font-weight: 650; }
.product-cell a { color: var(--navy); text-decoration: none; }
.product-cell a:hover { color: var(--teal-dark); }
.product-cell small a { color: var(--teal-dark); }
.product-cell small { display: block; margin-top: 4px; max-width: 380px; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decision, .run-status, .toggle-state { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; }
.decision.al, .run-status.success, .toggle-state.on { color: #087367; background: #daf5ef; }
.decision.tedarik_ara { color: #315f9e; background: #ddebff; }
.decision.izle, .run-status.running { color: #946719; background: #fff0c7; }
.decision.pas_gec, .run-status.failed, .toggle-state.off { color: #a53535; background: #fde2e2; }
.quality { width: 55px; height: 6px; display: inline-block; margin-right: 6px; border-radius: 99px; background: #e5ebee; overflow: hidden; vertical-align: middle; }
.quality i { display: block; height: 100%; background: var(--teal); }
.empty-state { padding: 65px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--navy); }
.sort-link { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.sort-link span { color: #9ba8b1; font-size: 13px; }
.sort-link.active { color: var(--navy); }
.sort-link.active span { color: var(--teal-dark); }
.favorite-button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: #eef2f5; color: #aab5bd; cursor: pointer; font-size: 18px; }
.favorite-button:hover, .favorite-button.active { color: #b7791f; background: #fff0c7; }
.button.favorite-active { color: #815a17; background: #fff0c7; border: 1px solid #f0d58e; }
.stage, .trend-state { display: inline-flex; width: max-content; padding: 5px 8px; border-radius: 999px; white-space: nowrap; font-size: 10px; font-weight: 850; }
.stage { color: #516270; background: #eef2f5; }
.stage.tedarik_ara { color: #315f9e; background: #ddebff; }
.stage.numune_al { color: #7b5a15; background: #fff0c7; }
.stage.test_satis { color: #6a4ba0; background: #eee6fb; }
.stage.olcekle { color: #087367; background: #daf5ef; }
.stage.vazgec { color: #a53535; background: #fde2e2; }
.trend-state.hizli { color: #a63d2d; background: #ffe2dc; }
.trend-state.yukseliyor { color: #087367; background: #daf5ef; }
.trend-state.yatay { color: #6d7881; background: #eef2f5; }
.trend-state.dusuyor { color: #a53535; background: #fde2e2; }
.trend-state.yeni { color: #315f9e; background: #ddebff; }
.cell-note { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.delta.up { color: #078f82; }
.delta.down { color: #c54444; }

.check-list { list-style: none; padding: 0; margin: 2px 0 0; display: grid; gap: 11px; }
.check-list li { position: relative; padding-left: 27px; color: var(--muted); font-size: 13px; }
.check-list li:before { content: ""; position: absolute; left: 0; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #c8d3da; }
.check-list li.done { color: var(--text); }
.check-list li.done:before { content: "✓"; display: grid; place-items: center; color: white; border-color: var(--teal); background: var(--teal); font-size: 11px; font-weight: 900; }
.report-list { display: grid; gap: 4px; }
.report-list a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf1f3; text-decoration: none; color: var(--navy); font-size: 12px; }
.report-list small, .muted { color: var(--muted); }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-links a { min-width: 0; padding: 13px; color: var(--navy); background: #f7fafb; border: 1px solid #e4eaee; border-radius: 12px; text-decoration: none; }
.quick-links span, .quick-links small { display: block; color: var(--muted); font-size: 10px; }
.quick-links strong { display: block; margin: 5px 0 3px; color: var(--teal-dark); font-size: 23px; }
.quick-links a:hover { border-color: #93ded5; background: var(--mint); }
.history-panel { margin-top: 22px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 22px; }
.upload-card { position: relative; padding: 28px; }
.upload-card .step { position: absolute; right: 24px; top: 20px; font-size: 36px; font-weight: 900; color: #e8eef1; }
.upload-card p { max-width: 620px; color: var(--muted); }
.accent-card { background: linear-gradient(140deg, #fff 55%, #edfbf8); }
.big-count { display: inline-block; margin-top: 6px; color: var(--navy); font-size: 36px; letter-spacing: -.04em; }
.upload-card form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.file-drop { flex: 1 1 100%; padding: 19px; border: 1.5px dashed #b6c8d1; border-radius: 13px; background: #f8fafb; cursor: pointer; }
.file-drop.selected { border-color: var(--teal); background: var(--mint); }
.file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.file-drop span, .file-drop small { display: block; }
.file-drop span { color: var(--navy); font-weight: 750; }
.file-drop small { margin-top: 3px; color: var(--muted); }
.event-list { display: grid; gap: 12px; }
.event-list > div { display: flex; gap: 10px; align-items: flex-start; }
.event-list i { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: #d34f4f; flex: 0 0 auto; }
.event-list i.success { background: var(--teal); }
.event-list span, .event-list small { display: block; }
.event-list strong { color: var(--navy); font-size: 11px; text-transform: uppercase; }
.event-list small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.discovery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.product-filters { display: grid; grid-template-columns: minmax(220px, 2fr) 1fr 1fr auto auto; gap: 10px; padding: 0 24px 18px; }
.product-filters input, .product-filters select { min-height: 42px; }
.source-list { display: grid; gap: 10px; }
.source-row { display: grid; grid-template-columns: minmax(230px, 1.4fr) 130px 110px 90px; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf1f3; }
.source-row:last-child { border-bottom: 0; }
.source-row strong, .source-row small { display: block; }
.source-row small { margin-top: 3px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-state { display: inline-flex; width: max-content; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; background: #eef2f5; color: var(--muted); }
.source-state.success { color: #087367; background: #daf5ef; }
.source-state.error { color: #a53535; background: #fde2e2; }
.source-add { display: grid; grid-template-columns: 1fr 1fr 1fr 2fr auto; gap: 10px; align-items: end; }
.source-add label { min-width: 0; }
.source-toggle { display: inline; }
.source-toggle button { min-width: 74px; }
.signal { display: inline-block; padding: 4px 7px; border-radius: 7px; color: #536372; background: #eef3f5; font-size: 10px; }
.period-tabs, .stage-tabs { height: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -8px 0 22px; }
.period-tabs > a, .stage-tabs > a { min-height: 42px; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 12px; font-weight: 750; }
.period-tabs > a.active, .stage-tabs > a.active { color: #073e38; border-color: #93ded5; background: var(--mint); }
.stage-tabs a strong { min-width: 20px; padding: 2px 5px; border-radius: 99px; color: var(--navy); background: #eef2f5; text-align: center; font-size: 10px; }
.period-tabs form { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.period-tabs input { min-height: 42px; width: 145px; }
.notice { margin: 0 0 22px; padding: 14px 17px; color: #5d501c; background: #fff8da; border: 1px solid #f1dda0; border-radius: 12px; font-size: 13px; }
.notice.small { margin: 16px 0 0; }
.category-radar { display: grid; gap: 7px; }
.category-radar > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf1f3; }
.category-radar span, .category-radar small { display: block; }
.category-radar small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.category-radar strong { color: var(--teal-dark); font-size: 18px; }
.product-title-head a { color: var(--teal-dark); text-decoration: none; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfd; }
.chart-card h3 { margin: 0 0 8px; color: var(--navy); font-size: 12px; }
.history-chart { display: block; width: 100%; height: 165px; }
.action-card form { display: grid; gap: 14px; }
.profit-result { margin-top: 17px; padding: 15px; border-radius: 12px; background: var(--mint); }
.profit-result span, .profit-result small { display: block; color: var(--muted); font-size: 11px; }
.profit-result strong { display: block; margin: 5px 0; color: var(--teal-dark); font-size: 22px; }

.settings-form { display: grid; gap: 18px; }
.form-section { padding: 26px; overflow: visible; }
.section-title { display: flex; gap: 14px; margin-bottom: 24px; }
.section-title > span { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; color: var(--teal-dark); background: var(--mint); font-weight: 900; }
.form-grid { display: grid; gap: 17px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
label { display: grid; gap: 7px; color: #52616e; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--text); background: white; border: 1px solid #ccd7de; border-radius: 9px; outline: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(16, 184, 166, .12); }
.switch-label { grid-template-columns: 1fr auto; align-items: center; align-content: center; padding: 10px 0; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 44px; height: 24px; padding: 3px; border-radius: 99px; background: #cbd5dc; transition: background .2s; }
.switch:after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: transform .2s; }
.switch-label input:checked + .switch { background: var(--teal); }
.switch-label input:checked + .switch:after { transform: translateX(20px); }
.sticky-save { position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; color: white; background: rgba(19, 34, 56, .96); border-radius: 14px; box-shadow: 0 16px 40px rgba(19, 34, 56, .24); backdrop-filter: blur(10px); }
.sticky-save span { font-size: 12px; color: #c1ccd5; }
.inline-test { margin-top: 16px; }

.login-card { width: min(920px, 96vw); min-height: 520px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 26px; background: white; box-shadow: 0 32px 90px rgba(0,0,0,.3); }
.login-visual { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 45px; color: white; text-align: center; background: linear-gradient(155deg, #0a9b8d, #132238); }
.login-visual p { max-width: 280px; color: #d9f8f4; line-height: 1.6; }
.radar { position: relative; width: 210px; height: 210px; margin-bottom: 40px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 34px, rgba(255,255,255,.13) 35px 36px); overflow: hidden; }
.radar:before, .radar:after { content: ""; position: absolute; background: rgba(255,255,255,.22); }
.radar:before { width: 1px; height: 100%; left: 50%; }
.radar:after { height: 1px; width: 100%; top: 50%; }
.radar span { position: absolute; left: 50%; top: 50%; width: 48%; height: 48%; transform-origin: 0 0; background: conic-gradient(from 0deg, rgba(31, 221, 199, .65), transparent 32deg); animation: scan 3s linear infinite; }
.radar i { position: absolute; left: 67%; top: 30%; width: 9px; height: 9px; border-radius: 50%; background: #b7fff5; box-shadow: 0 0 16px #b7fff5; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 55px; }
.login-form h1 { font-size: 34px; }
.login-form > p { color: var(--muted); line-height: 1.6; }
.login-form form { display: grid; gap: 18px; margin-top: 20px; }

.flash-stack { position: fixed; right: 24px; top: 92px; z-index: 50; display: grid; gap: 9px; width: min(420px, calc(100vw - 48px)); }
.flash { padding: 13px 16px; border-radius: 11px; background: var(--navy); color: white; box-shadow: var(--shadow); font-size: 13px; }
.flash.success { background: #087d70; }
.flash.error { background: #a93e3e; }
.flash.warning { background: #9a6b1c; }
.log-panel { padding: 0; background: #0d1929; }
.log-panel pre { margin: 0; padding: 24px; color: #cfdae5; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
footer { width: min(1480px, 92vw); margin: 0 auto 30px; color: #8b98a2; font-size: 11px; text-align: center; }

@keyframes blink { 50% { opacity: .35; } }
@keyframes scan { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-grid.four { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .content-grid.wide-left { grid-template-columns: 1fr; }
  .stack { grid-template-columns: 1fr 1fr; }
  .form-grid.four { grid-template-columns: repeat(2, 1fr); }
  nav a { padding: 0 9px; }
  .discovery-grid { grid-template-columns: repeat(2, 1fr); }
  .source-add { grid-template-columns: 1fr 1fr; }
  .product-filters { grid-template-columns: 1fr 1fr; }
  .product-filters input[type="search"] { grid-column: 1 / -1; }
  .source-add .button { align-self: end; }
}
@media (max-width: 820px) {
  .topbar { height: auto; padding: 14px 4vw; flex-wrap: wrap; gap: 12px; }
  .brand { min-width: auto; }
  nav { order: 3; width: 100%; height: 42px; overflow-x: auto; }
  nav a { white-space: nowrap; }
  .top-actions { margin-left: auto; }
  .shell { margin-top: 28px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-grid, .stack { grid-template-columns: 1fr; }
  .source-row { grid-template-columns: 1fr 100px; }
  .source-row > :nth-child(2) { display: none; }
  .form-grid.three, .form-grid.four { grid-template-columns: 1fr 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .period-tabs form { width: 100%; margin-left: 0; }
  .chart-grid { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}
@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { padding: 15px; }
  .metric strong { font-size: 23px; }
  .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .form-section, .upload-card { padding: 20px; }
  .login-form { padding: 38px 26px; }
  .sticky-save { align-items: stretch; flex-direction: column; }
  .discovery-grid, .source-add { grid-template-columns: 1fr; }
  .metric-grid.four, .product-filters { grid-template-columns: 1fr; }
  .period-tabs form { align-items: stretch; flex-direction: column; }
  .period-tabs input { width: 100%; }
}
