:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #2a211a;
  --muted: #7d7166;
  --line: #e6dfd5;
  --wood: #5b3a1e;
  --wood-soft: #f1e6d8;
  --good: #1f7a4d;
  --good-soft: #e3f3ea;
  --bad: #b3372c;
  --bad-soft: #fbe9e6;
  --warn: #9a6400;
  --warn-soft: #fdf1d6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--wood); }
h1, h2, p { margin: 0; }
svg { display: block; }

/* Üst çubuk */
.bar { position: sticky; top: 0; z-index: 10; background: var(--wood); color: #fff; padding-top: env(safe-area-inset-top); }
.bar-in { max-width: 860px; margin: 0 auto; min-height: 58px; padding: 0 12px; display: flex; align-items: center; gap: 10px; }
.bar a { color: #fff; text-decoration: none; }
.bar-brand { font-weight: 700; font-size: 19px; letter-spacing: .2px; padding-left: 4px; }
.bar-back { display: flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 12px 0 4px; border-radius: 12px; background: rgba(255, 255, 255, .14); font-weight: 600; }
.bar-back svg { width: 24px; height: 24px; }
.bar-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-user { margin-left: auto; max-width: 40%; min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 12px; background: rgba(255, 255, 255, .14); font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title + .bar-user { margin-left: 0; }

.page { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }

.hello { font-size: 21px; }
.section { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 15px; }
.center { text-align: center; }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* Ana ekran kutucukları */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 14px; min-height: 138px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-decoration: none; color: var(--ink); border: 1px solid transparent; transition: transform .08s, border-color .15s; }
.tile:hover { border-color: var(--wood); }
.tile:active { transform: scale(.97); }
.tile-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--wood-soft); color: var(--wood); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.tile-icon svg { width: 28px; height: 28px; }
.tile-title { font-size: 19px; font-weight: 700; }
.tile-desc { font-size: 14px; color: var(--muted); }
.tile-soon { opacity: .6; }
.tile-soon .tile-desc { background: var(--line); color: var(--ink); border-radius: 20px; padding: 1px 10px; font-size: 13px; }

/* Özet kutuları */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); min-width: 0; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-good .stat-value { color: var(--good); }
.stat-bad .stat-value { color: var(--bad); }
.stat-warn { background: var(--warn-soft); }
.stat-warn .stat-value { color: var(--warn); }

/* Düğmeler */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { width: 100%; }
.btn-main { background: var(--wood); border-color: var(--wood); color: #fff; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 6px 0 6px 10px; font: inherit; font-size: 14px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.logout { display: flex; justify-content: center; margin-top: 10px; }

/* Kart ve formlar */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 15px; font-weight: 600; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
input, select { width: 100%; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; appearance: none; -webkit-appearance: none; }
select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d7166' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
input:focus, select:focus { outline: none; border-color: var(--wood); box-shadow: 0 0 0 3px rgba(91, 58, 30, .15); }
input.big { font-size: 26px; font-weight: 700; min-height: 64px; }
.static { min-height: 52px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-weight: 700; }
.static a { font-weight: 600; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; }

/* Bildirimler */
.note { padding: 13px 16px; border-radius: 14px; font-weight: 600; }
.note-ok { background: var(--good-soft); color: var(--good); }
.note-err { background: var(--bad-soft); color: var(--bad); }
.note-warn { background: var(--warn-soft); color: var(--warn); }

/* Listeler */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; min-height: 64px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #faf7f2; }
.row-off { opacity: .5; }
.row-main, .row-side { display: flex; flex-direction: column; min-width: 0; }
.row-main { flex: 1; }
.row-main strong { overflow-wrap: anywhere; }
.row-side { align-items: flex-end; text-align: right; flex-shrink: 0; white-space: nowrap; }
.row small { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.row small.bad { color: var(--bad); font-weight: 700; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty h2 { color: var(--ink); font-size: 21px; }

/* Yetki tablosu */
.perm { border: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.perm legend { float: left; width: 100%; font-size: 19px; font-weight: 700; padding: 0; margin-bottom: 6px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.perm-row select { width: 150px; min-height: 46px; }
select.perm-view { background-color: var(--warn-soft); border-color: transparent; }
select.perm-edit { background-color: var(--good-soft); border-color: transparent; }
.who { display: flex; flex-direction: column; }

/* Giriş ekranı */
.login { max-width: 400px; width: 100%; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.login-logo { text-align: center; font-size: 28px; font-weight: 800; color: var(--wood); }
.login-sub { text-align: center; color: var(--muted); margin-top: -12px; }

@media (max-width: 380px) {
  .grid2 { grid-template-columns: 1fr; }
  .bar-back span { display: none; }
  .bar-back { padding: 0 8px; }
}
@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .page { padding-top: 24px; gap: 18px; }
}

/* Görünüm seçici (Normal Mod / Uzman Modu) */
.mode { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.mode button { flex: 1; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mode button.on { background: var(--card); color: var(--wood); box-shadow: var(--shadow); cursor: default; }
.home-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; }
.home-foot .mode { width: 100%; max-width: 340px; }
.who { gap: 10px; }

.logo-mark { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-mark svg { width: 100%; height: 100%; }
input[type=checkbox] { width: 22px; min-height: 0; height: 22px; padding: 0; border-radius: 6px; flex-shrink: 0; cursor: pointer; }
input[type=checkbox]:checked { background: var(--wood) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 16px no-repeat; border-color: var(--wood); }

/* ============ Uzman modu ============ */
.mode-expert { font-size: 15px; }
.mode-expert .page { max-width: 1320px; margin: 0; padding: 18px 16px 40px; gap: 16px; }

.side { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 248px; background: #33200f; color: #e9dccd; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .2s; overflow-y: auto; }
.side-open .side { transform: none; }
.side-shade { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(30, 18, 8, .5); }
.side-open .side-shade { display: block; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; line-height: 1.2; }
.side-brand .logo-mark { width: 38px; height: 38px; color: #e8b87a; }
.side-brand small { display: block; font-size: 12px; font-weight: 500; color: #b9a48d; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.side-nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #d9c8b5; text-decoration: none; font-weight: 600; }
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.on { background: #e8b87a; color: #33200f; }
.side-nav svg { width: 21px; height: 21px; flex-shrink: 0; }
.side-nav em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, .12); border-radius: 20px; padding: 1px 8px; }
.side-foot { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-user { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.side-user small { display: block; color: #b9a48d; font-size: 12px; }
.side-user strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #e8b87a; color: #33200f; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.side .mode { background: rgba(255, 255, 255, .1); }
.side .mode button { color: #d9c8b5; font-size: 13px; min-height: 34px; padding: 0 6px; }
.side .mode button.on { background: #fff; color: var(--wood); }
.side-logout { width: 100%; min-height: 38px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; background: transparent; color: #d9c8b5; font: inherit; font-weight: 600; cursor: pointer; }
.side-logout:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.xbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.xbar h1 { font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xbar-menu { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.xbar-menu svg { width: 22px; height: 22px; }
.xbar-back { font-weight: 700; text-decoration: none; white-space: nowrap; }
.xbar-date { color: var(--muted); font-size: 14px; white-space: nowrap; display: none; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); min-width: 0; }
.kpi:hover { border-color: var(--wood); }
.kpi span { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi strong { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-warn { background: var(--warn-soft); border-color: transparent; }
.kpi-warn strong { color: var(--warn); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-expert .btn { min-height: 44px; padding: 0 16px; border-radius: 10px; }
.mode-expert input, .mode-expert select { min-height: 44px; border-radius: 10px; }
.mode-expert input[type=checkbox] { min-height: 0; border-radius: 6px; }
.mode-expert input.big { min-height: 56px; }
.mode-expert .form.card { max-width: 760px; }
.mode-expert form.form:not(.card) { max-width: 760px; }
.mode-expert .actions { display: flex; }
.mode-expert .actions .btn { width: auto; }
.mode-expert .search { max-width: 420px; }
.mode-expert .stats { max-width: 760px; }

.panels { display: grid; grid-template-columns: 1fr; gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel h2 { font-size: 16px; }
.panel > header a { font-size: 14px; font-weight: 600; text-decoration: none; }
.panel-empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.chart { width: 100%; height: auto; padding: 12px 16px 6px; }
.legend { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .lg-good { background: var(--good); }
.legend .lg-bad { background: var(--bad); margin-left: 8px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #faf7f2; padding: 10px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: #faf7f2; }
.table tfoot td { background: #faf7f2; border-top: 1px solid var(--line); border-bottom: 0; font-size: 13.5px; color: var(--muted); }
.table tfoot strong { color: var(--ink); font-size: 15px; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table a { font-weight: 600; text-decoration: none; }
.table .link-btn { padding: 0; }
.table .muted { font-size: inherit; }
.nowrap { white-space: nowrap; }
tr.row-off { opacity: .55; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 700; background: var(--line); color: var(--muted); white-space: nowrap; }
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar input[type=search] { flex: 1 1 220px; width: auto; }
.toolbar select { flex: 0 1 200px; width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; cursor: pointer; }

@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .xbar-date { display: block; }
}
@media (min-width: 1000px) {
  .mode-expert { padding-left: 248px; }
  .side { transform: none; }
  .side-shade, .side-open .side-shade, .xbar-menu { display: none; }
  .mode-expert .page { padding: 22px 26px 48px; }
  .xbar { padding: 0 26px; }
  .panels { grid-template-columns: 1fr 1fr; }
}

/* ============ Giriş ekranı ============ */
.login-page { background: #fff; }
.login-page .page { max-width: none; padding: 0; gap: 0; }
.lg { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.lg-hero { position: relative; color: #fff; padding: calc(22px + env(safe-area-inset-top)) 24px 54px; display: flex; flex-direction: column; gap: 22px; overflow: hidden;
  background:
    repeating-linear-gradient(96deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 13px, rgba(0, 0, 0, .05) 13px 15px, transparent 15px 34px),
    radial-gradient(120% 90% at 0% 0%, #8a5a2e 0%, transparent 60%),
    linear-gradient(160deg, #5b3a1e 0%, #33200f 100%); }
.lg-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.lg-brand .logo-mark { width: 44px; height: 44px; color: #e8b87a; }
.lg-pitch { display: none; }
.lg-pitch h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.5px; }
.lg-pitch p { margin-top: 10px; color: #e3d2bf; max-width: 420px; }
.lg-copy { display: none; }
.lg-panel { flex: 1; background: #fff; border-radius: 26px 26px 0 0; margin-top: -26px; position: relative; padding: 30px 22px calc(30px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
.lg-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.lg-head h2 { font-size: 26px; letter-spacing: -.3px; }
.lg-head p { color: var(--muted); margin-top: 2px; }
.inp { position: relative; display: block; }
.inp > svg { position: absolute; left: 14px; top: 50%; width: 22px; height: 22px; margin-top: -11px; color: var(--muted); pointer-events: none; }
.inp input { padding-left: 46px; min-height: 56px; background: #faf7f2; }
.inp input:focus { background: #fff; }
.inp-btn { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--wood); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.inp-btn + input, .inp:has(.inp-btn) input { padding-right: 84px; }
.lg-form .btn { min-height: 56px; font-size: 18px; margin-top: 4px; box-shadow: 0 8px 20px rgba(91, 58, 30, .25); }
.lg-help { text-align: center; font-size: 14px; color: var(--muted); }

@media (min-width: 900px) {
  .lg { flex-direction: row; }
  .lg-hero { flex: 1.1; padding: 44px 56px; justify-content: flex-start; }
  .lg-brand > span:last-child { display: none; }
  .lg-brand .logo-mark { width: 84px; height: 84px; }
  .lg-brand { margin-top: auto; }
  .lg-copy { margin-top: auto; }
  .lg-pitch { display: block; }
  .lg-pitch h1 { font-size: 46px; }
  .lg-pitch p { font-size: 19px; margin-top: 16px; }
  .lg-copy { display: block; color: #b9a48d; font-size: 14px; }
  .lg-panel { flex: 1; margin: 0; border-radius: 0; align-items: center; padding: 40px; }
}
