/* dijitalfatura — tasarım sistemi (ui-ux-pro-max: B2B SaaS, hafif cam; kullanıcı paleti)
   Palet: lacivert #141456 · gece #25306A · çelik #305B8A · turkuaz #3AAEA6
   CSP yalnız bu dosyaya izin verir: satır içi stil ve dış kaynak yok. */
/* Plus Jakarta Sans (OFL 1.1, fonts/OFL.txt) — kendi sunucumuzdan; Google'a istek gitmez */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/PlusJakartaSans-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/PlusJakartaSans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --navy-900: #141456;
  --navy-700: #25306A;
  --steel: #305B8A;
  --teal: #3AAEA6;
  --teal-ink: #1F7470;          /* beyaz zeminde metin için turkuaz (≥4.5:1) */
  --teal-soft: #E3F4F2;

  --bg: #F3F5FA;
  --card: #FFFFFF;
  --fg: #1A1F3D;
  --fg-2: #3C4466;
  --muted: #5B6385;
  --border: #E1E5F0;
  --border-2: #EEF1F7;

  --danger: #C62828;
  --danger-soft: #FDECEC;
  --warn: #9A5B00;
  --warn-soft: #FFF4DE;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 20, 86, .06), 0 8px 24px -12px rgba(20, 20, 86, .18);
  --shadow-lg: 0 18px 40px -18px rgba(20, 20, 86, .35);
  --ring: 0 0 0 3px rgba(58, 174, 166, .45);
  --sans: "Plus Jakarta Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font: 400 16px/1.55 var(--sans); font-variant-numeric: tabular-nums;
}
a { color: var(--steel); text-underline-offset: 3px; font-weight: 600; }
a:hover { color: var(--navy-700); }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; color: var(--navy-900); }
h1 { font-size: clamp(1.45rem, 2.2vw, 1.85rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .9rem; }
p { margin: 0; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ───── Uygulama kabuğu: sol kenar çubuğu (cam) + içerik ───── */
.banner {
  margin: 0; padding: .5rem 1rem; text-align: center; font-weight: 800; letter-spacing: .1em;
  background: var(--danger); color: #fff; text-transform: uppercase; font-size: .78rem;
}
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.shell.guest { grid-template-columns: minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.5rem 1.1rem; color: #DCE1F5;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(58, 174, 166, .28), transparent 60%),
    radial-gradient(90% 50% at 100% 100%, rgba(48, 91, 138, .55), transparent 60%),
    linear-gradient(180deg, var(--navy-900), var(--navy-700));
}
.brand {
  display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--steel)); color: var(--navy-900);
  font-weight: 800; box-shadow: 0 6px 16px -6px rgba(58, 174, 166, .8);
}
.brand:hover { color: #fff; }
.env-badge {
  align-self: flex-start; font: 800 .66rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
  padding: .38rem .55rem; border-radius: 999px; color: var(--navy-900); background: #F7C873;
}
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar nav a, .sidebar .nav-button {
  display: flex; align-items: center; gap: .65rem; min-height: 44px; padding: .55rem .8rem; border-radius: 10px;
  color: #DCE1F5; text-decoration: none; font-weight: 600; font-size: .95rem; border: 1px solid transparent;
  background: transparent; width: 100%; cursor: pointer; transition: background .2s var(--ease), border-color .2s;
}
.sidebar nav a:hover, .sidebar .nav-button:hover {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff;
  backdrop-filter: blur(8px);
}
.sidebar nav a.active { background: rgba(58, 174, 166, .18); border-color: rgba(58, 174, 166, .45); color: #fff; }
.sidebar .icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .bottom { margin-top: auto; display: flex; flex-direction: column; gap: .75rem; }
.sidebar .bottom form { margin: 0; }
.sidebar .help { font-size: .78rem; color: #A9B2D6; line-height: 1.45; }
.sidebar { overflow-y: auto; }
.taxpayer-nav { display: flex; flex-direction: column; gap: .5rem; }
.taxpayer-nav .back { color: #A9B2D6; font-size: .85rem; font-weight: 600; text-decoration: none; padding: .2rem .8rem; }
.taxpayer-nav .back:hover { color: #fff; }
/* Seçili mükellef: defter başlığı gibi içerik alanının tepesinde; altında palet şeridi */
.topbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.5rem;
  padding: .85rem clamp(1rem, 3.5vw, 2.6rem); background: var(--card); border-bottom: 1px solid var(--border);
  animation: tp-in .35s var(--ease, ease) both; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--navy-700), var(--steel) 55%, var(--teal)); }
@keyframes tp-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tp { display: flex; align-items: center; gap: .85rem; min-width: 0; flex: 1 1 22rem; }
.tp-mark { position: relative; flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font-weight: 800; font-size: .95rem; letter-spacing: .02em; color: #fff;
  background: linear-gradient(140deg, var(--navy-900), var(--navy-700) 55%, var(--steel)); box-shadow: 0 8px 18px -10px rgba(20, 20, 86, .8); }
.tp-mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--teal); border: 2px solid var(--card); }
.tp-text { display: flex; flex-direction: column; min-width: 0; gap: .1rem; }
.tp-label { font-size: .64rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-ink); }
.tp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.02rem; font-weight: 800;
  letter-spacing: -.01em; color: var(--navy-900); text-decoration: none; }
.tp-name:hover { color: var(--steel); }
.tp-meta { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .8rem; color: var(--muted); }
.tp-meta .mono { font-size: .78rem; }
.tp-side { display: flex; align-items: center; gap: .5rem; flex: none; }
.tp-pill { padding: .28rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 800; color: var(--muted); background: var(--border-2); }
.tp-pill.on { color: var(--teal-ink); background: var(--teal-soft); }
.tp-switch { padding: .4rem .75rem; border-radius: 9px; border: 1px solid var(--border); font-size: .82rem; font-weight: 700;
  color: var(--navy-700); text-decoration: none; }
.tp-switch:hover { border-color: var(--steel); color: var(--navy-900); }

/* Aranabilir seçim kutusu (il, ilçe, vergi dairesi) */
.combo { position: relative; }
.combo-input { padding-right: 2.2rem; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235B6385' stroke-width='2'/%3E%3C/svg%3E") no-repeat right .8rem center; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 16rem; overflow-y: auto; margin: 0; padding: .3rem;
  list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 14px 34px -14px rgba(20, 20, 86, .35); }
.combo-list[hidden] { display: none; }
.combo-list li { padding: .5rem .65rem; border-radius: 7px; cursor: pointer; font-size: .92rem; color: var(--fg); }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--teal-soft); color: var(--navy-900); }
.combo-list .combo-empty { color: var(--muted); cursor: default; background: none; }
.sidebar nav a[aria-current="page"] { background: rgba(58, 174, 166, .2); border-color: rgba(58, 174, 166, .5); color: #fff; }

.content { min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; padding: clamp(1.1rem, 3vw, 2.2rem) clamp(1rem, 3.5vw, 2.6rem) 4rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; margin-bottom: 1.6rem; }
.page-head .sub { color: var(--muted); margin-top: .35rem; font-size: .95rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-ink); margin-bottom: .3rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }   /* 1fr tablonun en küçük genişliğine büyürdü */
  /* telefonda iki satır: logo + rozet + çıkış, altında menü */
  .sidebar {
    position: static; height: auto; display: grid; grid-template-columns: auto 1fr auto;
    align-items: center; gap: .55rem .75rem; padding: .75rem 1rem;
  }
  .env-badge { justify-self: start; white-space: nowrap; }
  .sidebar .bottom { grid-column: 3; grid-row: 1; margin-top: 0; }
  .sidebar nav { grid-column: 1 / -1; flex-direction: row; gap: .4rem; }
  .sidebar nav a { flex: 1; justify-content: center; min-height: 44px; padding: .4rem .6rem; background: rgba(255, 255, 255, .06); }
  .sidebar .nav-button { min-height: 40px; padding: .4rem .65rem; width: auto; }
  .sidebar .help { display: none; }
  .taxpayer-nav { grid-column: 1 / -1; gap: .4rem; }
  .taxpayer-nav .back { display: none; }
  .topbar { padding: .7rem 1rem; }
  .tp-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .taxpayer-nav nav { flex-wrap: wrap; }
  .taxpayer-nav nav a { flex: 1 1 30%; font-size: .85rem; gap: .4rem; }
}

/* ───── Kart ───── */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.35rem 1.45rem; box-shadow: var(--shadow); animation: lift .3s var(--ease) both;
}
.stack-cards { display: flex; flex-direction: column; gap: 1.25rem; margin: 0; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; align-items: start; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); font-weight: 700; font-size: .86rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.layout-invoice { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.layout-invoice aside { position: sticky; top: 1.25rem; }
@media (max-width: 1180px) { .layout-invoice { grid-template-columns: 1fr; } .layout-invoice aside { position: static; max-width: 440px; } }
/* yalnız kayma: görünürlük animasyona bağlı olmasın */
@keyframes lift { from { transform: translateY(6px); } to { transform: none; } }

/* ───── Form ───── */
label { display: flex; flex-direction: column; gap: .35rem; font-size: .84rem; font-weight: 700; color: var(--fg-2); }
input, select, textarea {
  font: inherit; font-size: .95rem; color: var(--fg); background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: .62rem .75rem; min-height: 44px; min-width: 0; width: 100%;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #C9D0E3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: #9AA1BD; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--teal-ink); cursor: pointer; }
textarea { min-height: 5.5rem; resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 1rem; margin: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem 1.1rem; }
.fields .wide { grid-column: span 2; }
@media (max-width: 560px) {
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem .75rem; }
  .fields .wide { grid-column: 1 / -1; }
}
.hint { font-size: .82rem; color: var(--muted); font-weight: 500; }
.top-gap { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px dashed var(--border); }
.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1.1rem; }
.toolbar label { width: 13rem; }
.toolbar .toolbar-add { margin-left: auto; }

/* ───── Düğmeler ───── */
button, .btn-primary, .btn-secondary, .btn-small, .btn-accent {
  font: 700 .92rem/1 var(--sans); border-radius: var(--radius-sm); padding: .75rem 1.15rem; min-height: 44px;
  cursor: pointer; border: 1.5px solid transparent; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  transition: background .2s var(--ease), color .2s, border-color .2s, transform .1s, box-shadow .2s;
}
button:active { transform: translateY(1px); }
.btn-primary, button[type="submit"]:not(.btn-secondary):not(.btn-small):not(.nav-button):not(.btn-accent) {
  background: var(--navy-700); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 48, 106, .7);
}
.btn-primary:hover, button[type="submit"]:not(.btn-secondary):not(.btn-small):not(.nav-button):not(.btn-accent):hover { background: var(--navy-900); color: #fff; }
.btn-accent { background: var(--teal); color: var(--navy-900); box-shadow: 0 6px 16px -8px rgba(58, 174, 166, .9); }
.btn-accent:hover { background: #33A098; }
.btn-secondary, .btn-small { background: #fff; color: var(--navy-700); border-color: var(--border); }
.btn-secondary:hover, .btn-small:hover { border-color: var(--steel); color: var(--navy-900); background: #F7F9FD; }
.btn-small { padding: .5rem .75rem; min-height: 36px; font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.1rem; }

/* ───── Uyarılar ───── */
.alert { margin: 0 0 1.1rem; padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem; }
.alert ul { margin: .3rem 0 0; padding-left: 1.15rem; }
.alert strong { display: block; margin-bottom: .1rem; }
.alert-error { background: var(--danger-soft); border-color: #F3B9B9; color: #8E1C1C; }
.alert-warn { background: var(--warn-soft); border-color: #F1D49A; color: var(--warn); }
.alert-info { background: var(--teal-soft); border-color: #B7E3DE; color: #145552; }

/* ───── Tablolar ───── */
.table-wrap { position: relative; overflow-x: auto; margin: 0 -1.45rem; padding: 0 1.45rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
th {
  text-align: left; font: 800 .7rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: .7rem .6rem; background: #F7F9FD; border-bottom: 1px solid var(--border); white-space: nowrap;
}
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
td { padding: .7rem .6rem; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: #F8FAFD; }
.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
th.num { font-family: var(--sans); }
.check { width: 2.4rem; }

table.lines { min-width: 780px; }
table.lines tbody { counter-reset: kalem; }
table.lines tbody tr { counter-increment: kalem; }
table.lines .c-no { width: 3.6rem; white-space: nowrap; }
table.lines td.c-no { display: flex; align-items: center; gap: .15rem; padding-top: .55rem; }
table.lines .no::before { content: counter(kalem); font: 700 .85rem var(--mono); color: var(--muted); }
table.lines .c-disc { width: 4.8rem; }
table.lines th:nth-child(2), table.lines .c-name { min-width: 12rem; }
table.lines .c-del { width: 2.6rem; }
table.lines input[name="iskonto_orani"] { text-align: right; font-family: var(--mono); }
.drag, .btn-icon { display: inline-grid; place-items: center; width: 30px; height: 34px; min-height: 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); box-shadow: none; cursor: grab; touch-action: none; }
.btn-icon { width: 34px; cursor: pointer; touch-action: auto; }
.drag svg { width: 18px; height: 18px; fill: currentColor; }
.btn-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drag:hover, .btn-icon:hover { background: var(--border-2); color: var(--navy-900); }
.btn-icon:hover { color: var(--danger); background: var(--danger-soft); }
table.lines tr.dragging { opacity: .55; }
table.lines tr.dragging td { background: var(--teal-soft); }
.req { color: var(--danger); font-weight: 800; }
label[data-req-when]:not(.is-req) .req { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.lines td { padding: .4rem .3rem; vertical-align: top; }
table.lines input, table.lines select { padding: .5rem .5rem; }
table.lines .c-qty { width: 5.8rem; }
table.lines .c-unit { width: 6.8rem; }
table.lines .c-price { width: 7.4rem; }
table.lines .c-vat { width: 5.2rem; }
table.lines .c-amount { width: 7rem; padding-top: .85rem; font-weight: 600; color: var(--navy-700); }
table.lines input[name="miktar"], table.lines input[name="birim_fiyat"] { text-align: right; font-family: var(--mono); }
.original { display: block; font-size: .74rem; color: var(--muted); margin-top: .25rem; font-style: italic; }

/* telefonda her kalem bir kart: ad tam genişlik, altında miktar/birim, fiyat/KDV, en altta tutar */
@media (max-width: 640px) {
  .table-wrap:has(table.lines) { margin: 0; padding: 0; overflow: visible; }
  table.lines { min-width: 0; }
  table.lines thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.lines, table.lines tbody { display: block; }
  table.lines tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem .6rem;
    padding: .85rem; margin-bottom: .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #FBFCFE;
  }
  table.lines td[class] { display: flex; flex-direction: column; gap: .25rem; padding: 0; border: 0; width: auto; }
  table.lines tbody tr:hover td { background: transparent; }
  table.lines td[data-label]::before { content: attr(data-label); font: 700 .72rem/1.2 var(--sans); color: var(--muted); }
  table.lines .c-name { grid-column: 1 / -1; }
  table.lines td.c-no { flex-direction: row; order: -2; padding: 0; }
  table.lines td.c-del { order: -1; align-items: flex-end; }
  table.lines td.c-amount { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; padding-top: .35rem; border-top: 1px dashed var(--border); }
}

/* ───── Durum rozetleri ───── */
.status {
  display: inline-flex; align-items: center; gap: .35rem; font: 700 .74rem/1 var(--sans);
  padding: .38rem .6rem; border-radius: 999px; white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-ONIZLEME { color: var(--fg-2); background: #EEF1F7; }
.status-TASLAK { color: var(--warn); background: var(--warn-soft); }
.status-ONAYLI { color: var(--teal-ink); background: var(--teal-soft); }
.status-HATA { color: var(--danger); background: var(--danger-soft); }
.tag { display: inline-block; font-size: .74rem; font-weight: 700; color: var(--steel); background: #E8EEF6; padding: .25rem .6rem; border-radius: 999px; }

/* ───── Mükellef kartları ───── */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.1rem; }
.tiles a {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .45rem; padding: 1.25rem 1.3rem;
  text-decoration: none; color: var(--fg); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
  animation: lift .3s var(--ease) both;
}
.tiles a::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--navy-700), var(--steel), var(--teal));
}
.tiles a:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #CBD3E8; color: var(--fg); }
.tiles strong { font-size: 1.08rem; font-weight: 800; color: var(--navy-900); }
.tiles .tag { align-self: flex-start; margin-top: .2rem; }
.empty {
  padding: 2.2rem 1.5rem; text-align: center; border: 2px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); background: rgba(255, 255, 255, .6);
}

/* ───── Dosya bırakma alanı ───── */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  text-align: center; padding: 1.8rem 1.2rem; border: 2px dashed #C3CBE2; border-radius: var(--radius);
  background: linear-gradient(180deg, #FBFCFF, #F3F6FC); cursor: pointer; color: var(--muted); font-weight: 600;
  transition: border-color .2s var(--ease), background .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: var(--teal-soft); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.dropzone .big { font-size: 1.08rem; font-weight: 800; color: var(--navy-900); }
.dropzone .files { font-size: .84rem; color: var(--teal-ink); font-weight: 700; }
.dropzone .icon { width: 30px; height: 30px; stroke: var(--steel); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ───── Toplam kartı (koyu) ───── */
.receipt {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 1.3rem 1.35rem; color: #E4E8F7;
  background:
    radial-gradient(110% 70% at 100% 0%, rgba(58, 174, 166, .35), transparent 60%),
    linear-gradient(160deg, var(--navy-700), var(--navy-900));
  box-shadow: var(--shadow-lg); animation: lift .3s var(--ease) .05s both;
}
.receipt h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: #A9B2D6; }
.receipt dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: .55rem .75rem; }
.receipt dt { color: #C3CAE6; }
.receipt dd { margin: 0; text-align: right; font-family: var(--mono); color: #fff; }
.receipt .total { border-top: 1px solid rgba(255, 255, 255, .18); padding-top: .75rem; margin-top: .3rem; font-weight: 800; color: #fff; }
.receipt dd.total { font-size: 1.55rem; color: var(--teal); letter-spacing: -.02em; }
.receipt .pending { color: #C3CAE6; font-size: .9rem; }
.receipt form { margin-top: 1.2rem; }
.receipt form button { width: 100%; }
.receipt .hint { margin-top: .7rem; color: #A9B2D6; }
.note { font-size: .84rem; color: var(--navy-900); background: #F7C873; border-radius: var(--radius-sm); padding: .6rem .75rem; margin-top: 1rem; font-weight: 600; }

/* ───── Giriş ───── */
.auth-wrap { min-height: calc(100vh - 2rem); display: grid; place-items: center; padding: 2rem 1rem; }
.auth { width: 100%; max-width: 420px; }
.auth .brand { color: var(--navy-900); margin-bottom: 1.25rem; }
.auth h1 { margin-bottom: .35rem; }
.auth .sub { color: var(--muted); margin-bottom: 1.2rem; }
body.guest-bg {
  background:
    radial-gradient(60% 50% at 0% 0%, rgba(58, 174, 166, .18), transparent 60%),
    radial-gradient(60% 60% at 100% 100%, rgba(48, 91, 138, .2), transparent 60%),
    var(--bg);
}
.guest-top { display: flex; justify-content: flex-end; padding: 1rem 1.25rem 0; }

/* ───── Filtre, satır işlemleri ───── */
.filter { display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end; margin: 0; }
.filter label { min-width: 160px; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }
details.settings summary { cursor: pointer; font-weight: 700; color: var(--navy-700); min-height: 32px; display: flex; align-items: center; }
details.settings[open] summary { margin-bottom: .9rem; }
.inline { display: inline; margin: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

td.mono { white-space: nowrap; }
td.doc-links .btn-small { padding: .3rem .55rem; font-size: .78rem; min-height: 0; }
td.doc-links { padding-left: .4rem; padding-right: .4rem; }

/* Yeni fatura: iki başlangıç yolu */
.start-head { margin-bottom: 1.1rem; }
.start-head p { margin-top: .35rem; color: var(--muted); }
.start-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.start-card { display: flex; flex-direction: column; gap: .9rem; padding: 1.4rem; margin: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 1px 2px rgba(20, 20, 86, .04);
  transition: border-color .2s, box-shadow .2s, transform .2s; animation: start-in .4s both; }
.start-card + .start-or + .start-card { animation-delay: .08s; }
.start-card:hover, .start-card:focus-within { border-color: var(--teal); box-shadow: 0 16px 34px -22px rgba(20, 20, 86, .45); transform: translateY(-2px); }
@keyframes start-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.start-top { display: flex; gap: .9rem; align-items: flex-start; }
.start-top h2 { font-size: 1.12rem; }
.start-top p { margin-top: .25rem; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.start-icon { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--navy-900), var(--navy-700) 60%, var(--steel)); }
.start-icon.alt { color: var(--navy-900); background: linear-gradient(140deg, var(--teal), #7FD3CC); }
.start-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.start-card .opt { font-weight: 600; font-size: .75rem; color: var(--muted); margin-left: .3rem; }
.start-go { margin-top: auto; align-self: flex-start; display: inline-flex; gap: .5rem; align-items: center; }
.start-go span { transition: transform .2s; }
.start-go:hover span { transform: translateX(3px); }
.start-or { display: flex; align-items: center; justify-content: center; }
.start-or span { padding: .35rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); background: var(--bg); border: 1px solid var(--border); }
.dropzone.compact { padding: 1.1rem; gap: .3rem; }
.dropzone.compact .big { font-size: .95rem; }
.start-note summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--steel); }
.start-note textarea { margin-top: .5rem; min-height: 5rem; }
.start + .card { margin-top: .4rem; }
@media (max-width: 1000px) {
  .start-grid { grid-template-columns: minmax(0, 1fr); }
  .start-or { margin: -.3rem 0; }
}
@media (prefers-reduced-motion: reduce) { .start-card, .start-card:hover { animation: none; transform: none; } }

/* Fatura notu: girişler solda, GİB'e gidecek not alanının önizlemesi sağda; satırlar alt alta */
.note-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.check-row { display: flex; gap: .55rem; align-items: center; font-weight: 600; font-size: .88rem; }
.note-preview { padding: 1rem 1.1rem; border-radius: 12px; background: #FBFCFE; border: 1px dashed var(--border); }
.note-preview-title { margin: 0 0 .6rem; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.note-line { margin: 0; padding: .35rem 0; border-top: 1px solid var(--border-2); overflow-wrap: anywhere; white-space: pre-line; }
.note-line:first-of-type { border-top: 0; }
.note-line.words { font-weight: 700; color: var(--navy-900); }
.note-line.mono { font-size: .88rem; }
.note-line.free:empty, .note-line[hidden] { display: none; }
@media (max-width: 860px) { .note-grid { grid-template-columns: minmax(0, 1fr); } }
.note-grid label.check-row { display: flex; flex-direction: row; justify-content: flex-start; text-align: left; }
.note-grid label.check-row input { width: 20px; flex: none; }
.filter input[name="iban"] { min-width: min(22rem, 70vw); }

/* Fatura tipi: tevkifat ve iade alanları yalnız ilgili tipte görünür */
.kind-row { display: flex; flex-wrap: wrap; gap: .9rem 1.1rem; align-items: flex-end; }
.kind-row label { flex: 1 1 11rem; min-width: 0; max-width: 16rem; }
.kind-hint { flex-basis: 100%; margin: 0; }
[data-kind-scope]:not([data-kind-scope="IADE"]) .iade-only,
[data-kind-scope]:not([data-kind-scope="TEVKIFAT"]) .tev-only,
table.lines:not(.with-tev) .c-tev { display: none; }
table.lines .c-tev { width: 11rem; }
table.lines .c-tev select { font-size: .8rem; }
table.lines.with-tev { min-width: 960px; }

/* İstisna, ihraç kayıtlı, özel matrah */
[data-kind-scope]:not([data-kind-scope="ISTISNA"]):not([data-kind-scope="IHRACKAYITLI"]):not([data-kind-scope="OZELMATRAH"]) .exempt-only,
table.lines:not(.with-gtip) .c-gtip, table.lines:not(.with-om) .c-om { display: none; }
table.lines .c-gtip { width: 9rem; }
table.lines .c-om { width: 7rem; }
table.lines input[name="ozel_matrah"] { text-align: right; font-family: var(--mono); }
table.lines.with-gtip, table.lines.with-om { min-width: 900px; }
.kind-row label.exempt-only { max-width: 24rem; }
