/* Bosch KMP — tek stil dosyası.
   Renkler :root değişkenlerinde; koyu tema yalnızca değişkenleri değiştirir.
   Kırılımlar: ≤1100px (dar masaüstü), ≤860px (tablet/telefon: üst menü, kart tablolar), ≤520px (telefon). */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f6;
  --border: #e1e7ed;
  --border-strong: #cbd5df;
  --ink: #17293a;
  --ink-2: #4a5d6e;
  --ink-3: #7b8c9b;
  --primary: #1f3a52;
  --primary-ink: #ffffff;
  --primary-hover: #2b4c69;
  --accent: #e8731c;
  --focus: #3b82c4;
  --good: #1e7a4c;
  --good-bg: #e6f4ec;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --selected: #e8f0f8;
  --shadow: 0 1px 2px rgb(16 32 48 / 6%), 0 4px 16px rgb(16 32 48 / 4%);
  --radius: 10px;
  --radius-sm: 7px;
  --aside: 248px;
  color-scheme: light;
}
html[data-theme='dark'] {
  --bg: #121a23;
  --surface: #1a2430;
  --surface-2: #1f2a37;
  --surface-3: #263343;
  --border: #2c3a4a;
  --border-strong: #3b4c5f;
  --ink: #e8eef4;
  --ink-2: #b6c3cf;
  --ink-3: #8798a8;
  --primary: #5b8fbf;
  --primary-ink: #0d1620;
  --primary-hover: #74a3cf;
  --focus: #7fb2e0;
  --good: #6fd19c;
  --good-bg: #183528;
  --warn: #f0c066;
  --warn-bg: #3a2f17;
  --bad: #ff8a80;
  --bad-bg: #3d1f1e;
  --selected: #23364a;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  color-scheme: dark;
}

/* ---------- Temel ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.5 'Segoe UI',
    system-ui,
    -apple-system,
    Roboto,
    Arial,
    sans-serif;
  display: grid;
  grid-template-columns: var(--aside) minmax(0, 1fr);
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  color: var(--ink);
}
h1 {
  font-size: 24px;
  font-weight: 700;
}
h2 {
  font-size: 18px;
  font-weight: 650;
}
h3 {
  font-size: 15px;
  font-weight: 650;
}
p {
  margin: 0;
  color: var(--ink-2);
}
small {
  font-size: 12px;
}
img {
  max-width: 100%;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Form öğeleri ---------- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
input[type='checkbox'],
input[type='radio'] {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex: none;
  accent-color: var(--primary);
}
input[data-currency],
input.amount-input,
input.rate-input,
input.qty,
input.catalog-qty {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[aria-invalid='true'] {
  border-color: var(--bad);
}
textarea {
  resize: vertical;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
}
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 16px 0;
}
.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.panel > label,
form > label,
.calc-controls > label {
  margin-bottom: 14px;
}

/* ---------- Düğmeler ---------- */
button,
.secondary,
label.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover:not(:disabled),
label.secondary:hover {
  border-color: var(--ink-3);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary,
.dark {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.primary:hover:not(:disabled),
.dark:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.text-button,
.subtle {
  min-height: 32px;
  padding: 4px 8px;
  border-color: transparent;
  background: transparent;
  color: var(--primary);
}
html[data-theme='dark'] .text-button,
html[data-theme='dark'] .subtle {
  color: var(--primary-hover);
}
.text-button:hover:not(:disabled),
.subtle:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: transparent;
}
.danger,
html[data-theme='dark'] .danger {
  color: var(--bad);
}
.full {
  width: 100%;
}
.icon,
.remove {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}
.remove:hover:not(:disabled) {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: transparent;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.stack {
  display: grid;
  gap: 8px;
}

/* ---------- Kabuk: yan menü ---------- */
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 20;
}
.aside-head {
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-toggle {
  display: none;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 16px;
  text-decoration: none;
  color: var(--ink);
  text-align: center;
}
.company-logo {
  display: block;
  max-width: 150px;
  max-height: 72px;
  object-fit: contain;
}
.company-logo.plate {
  padding: 8px 14px;
  background: #fff;
  border-radius: var(--radius);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  font-size: 20px;
}
.brand-name {
  display: grid;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.brand-name small {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.aside-menu {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
nav {
  display: grid;
  gap: 2px;
}
nav button {
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
  font-weight: 550;
  text-align: left;
}
nav button:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: transparent;
}
nav button.active {
  background: var(--selected);
  color: var(--ink);
  font-weight: 650;
}
nav button.active svg {
  color: var(--accent);
}
nav svg,
.menu-toggle svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
nav span {
  flex: 1;
}
#basketBadge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  text-align: center;
}
.aside-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}
.session-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-profile > span:last-child {
  display: grid;
}
.session-profile small {
  color: var(--ink-3);
}
.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 10px;
}
.aside-bottom .text-button {
  justify-self: start;
}

/* ---------- Kabuk: içerik ---------- */
main {
  min-width: 0;
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
}
.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#view {
  display: grid;
  gap: 16px;
  align-content: start;
  flex: 1;
}
#view > * {
  min-width: 0;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--ink-3);
}
body.unauthenticated > aside,
body.unauthenticated > main {
  display: none;
}

/* ---------- Paneller ve başlıklar ---------- */
.panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel > h3 + p,
.panel > h2 + p {
  margin: 6px 0 14px;
  font-size: 13px;
}
.table-panel {
  padding: 0;
  overflow: hidden;
}
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.section-heading > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.section-heading p {
  font-size: 13px;
}
.eyebrow,
.doc-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.toolbar h3 {
  margin-right: auto;
}
.toolbar > input,
.toolbar > select {
  width: auto;
  min-width: 180px;
}
.muted {
  color: var(--ink-3);
  font-weight: 500;
}
.hint {
  font-size: 12px;
  color: var(--ink-3);
}
.panel .hint {
  margin-top: 10px;
}
.line-sub {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}
.error-text {
  color: var(--bad);
  font-size: 13px;
  min-height: 0;
}
.error-text:empty {
  display: none;
}

/* ---------- Bildirim ve rozet ---------- */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
}
#notice:empty {
  display: none;
}
#notice {
  margin-bottom: 16px;
}
.notice.warn {
  background: var(--warn-bg);
  border-color: transparent;
  color: var(--warn);
}
.notice.error {
  background: var(--bad-bg);
  border-color: transparent;
  color: var(--bad);
}
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.badge.good {
  background: var(--good-bg);
  color: var(--good);
}
.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge + .badge {
  margin-left: 4px;
}
.active-rate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface-3);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.active-rate i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
}
.active-rate b {
  color: var(--ink);
}

/* ---------- Özet kartları ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.metrics.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metric > span {
  font-size: 12px;
  color: var(--ink-3);
}
.metric > strong {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric > small {
  color: var(--ink-3);
}
.metric > small:empty {
  display: none;
}
.selected-bank-kpi {
  border-color: var(--primary);
}

/* ---------- Tablolar ---------- */
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
  position: relative;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--surface-2);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td.price,
td.price strong {
  font-weight: 700;
}
td.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--ink-3);
}
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-3);
}
.table-foot > div {
  display: flex;
  gap: 6px;
}
.table-foot button {
  min-height: 32px;
  padding: 4px 12px;
}
.list-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.qty,
.catalog-qty {
  width: 76px;
  min-height: 34px;
  padding: 4px 8px;
}
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.price-changed {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--warn);
}
.best-label {
  display: block;
  font-size: 11px;
  color: var(--good);
}
.selected-bank-row td,
tbody tr.selected-bank-row:hover td {
  background: var(--selected);
}
.finance-table tbody tr {
  cursor: pointer;
}
.remainder-row td {
  background: var(--surface-2);
}
.card-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 700;
}
.remainder-row .card-number {
  background: var(--primary);
  color: var(--primary-ink);
}
.amount-input {
  max-width: 160px;
  margin-left: auto;
  display: block;
}
.payment-table select {
  min-width: 120px;
}

/* Katalog: kişisel sütun genişlikleri (masaüstü) */
/* Katalog: sütunlar içeriğe göre, tablo gereğinden geniş olmaz */
.configurable-table {
  width: auto;
}
.configurable-table td,
.configurable-table th {
  white-space: nowrap;
}
.configurable-table th {
  padding-right: 20px;
}
.configurable-table th.num,
.configurable-table td.num {
  padding-left: 32px;
}
.configurable-table .list-name {
  max-width: 280px;
}
/* Katalog: ince satırlar */
.catalog-table th {
  padding: 7px 12px;
}
.catalog-table td {
  padding: 3px 12px;
  height: 34px;
}
.catalog-table .catalog-qty {
  width: 64px;
  min-height: 28px;
  height: 28px;
  padding: 2px 8px;
}
.configurable-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
}
.resize-handle:hover {
  background: var(--border-strong);
}
.filter-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.filter {
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 550;
}
.filter.active {
  background: var(--selected);
  border-color: var(--primary);
  color: var(--ink);
}
.search-box {
  position: relative;
  flex: 1 1 220px;
  max-width: 320px;
}
.search-box input {
  padding-right: 36px;
}
.search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
  font-size: 18px;
}
.column-options {
  position: relative;
}
.column-options summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.column-options summary::-webkit-details-marker {
  display: none;
}
.column-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: 300px;
  max-width: calc(100vw - 32px);
  display: grid;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
}
.column-menu p {
  font-size: 12px;
}
.column-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.column-option input[type='number'] {
  width: 90px;
  min-height: 34px;
}

/* ---------- Sayfa düzenleri ---------- */
.split {
  display: grid;
  gap: 16px;
  align-items: start;
}
.basket-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}
.basket-layout > div {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.permission-layout {
  grid-template-columns: minmax(0, 1fr) 380px;
}
.permission-layout form.panel {
  display: grid;
  gap: 12px;
}
.calculation-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.calculation-layout > div {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.calc-controls h2 {
  margin: 4px 0 6px;
}
.calc-controls > p {
  margin-bottom: 16px;
  font-size: 13px;
}
.control-note {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.settings-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.sticky-summary {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 10px;
}
.big-number {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.summary-line.total {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.saved-basket-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.saved-basket-bar > div:first-child {
  display: grid;
  gap: 4px;
}
.saved-basket-bar p {
  font-size: 13px;
}
.saved-basket-bar select {
  width: auto;
  min-width: 220px;
}
.add-card-action {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
}
.empty {
  display: grid;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
}
.empty h2 {
  font-size: 16px;
}

/* ---------- Ayarlar ---------- */
.company-settings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  margin-top: 16px;
}
.company-settings .form-grid {
  margin-top: 0;
}
.logo-uploads {
  display: grid;
  grid-template-columns: repeat(2, 170px);
  gap: 12px;
  align-content: start;
}
.logo-upload {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
}
.logo-upload img,
.logo-placeholder {
  width: 100%;
  height: 72px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.logo-upload img {
  background: #fff;
  padding: 6px;
}
.logo-upload.dark-preview img {
  background: #121a23;
}
.logo-placeholder {
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--ink-3);
  font-weight: 700;
  letter-spacing: 0.1em;
}
.logo-upload small {
  color: var(--ink-3);
  font-size: 11px;
}
.brand-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 260px));
  gap: 12px;
  margin-top: 14px;
}
.brand-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.brand-choice > span {
  display: grid;
}
.brand-choice b {
  color: var(--ink);
  font-size: 14px;
}
.brand-choice small {
  color: var(--ink-3);
  font-weight: 500;
}
.brand-choice.active {
  border-color: var(--primary);
  background: var(--selected);
}
.rate-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--border);
}
.rate-tabs button {
  min-height: 38px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-3);
}
.rate-tabs button.active {
  border-bottom-color: var(--primary);
  color: var(--ink);
}
.rate-tabs span {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--good-bg);
  color: var(--good);
  font-size: 10px;
}
.rates-table th:first-child,
.rates-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}
.rates-table th:first-child {
  background: var(--surface-2);
}
.rates-table td:first-child {
  white-space: nowrap;
}
/* Oran tablosu: sıkı düzen */
.rates-table th {
  padding: 7px 8px;
}
.rates-table td {
  padding: 3px 8px;
}
.rates-table td:first-child {
  font-size: 12px;
}
.rate-input {
  width: 68px;
  min-height: 28px;
  height: 28px;
  padding: 2px 6px;
  font-size: 12.5px;
}
.tab-toggles {
  display: grid;
  margin: 8px 0 14px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
#manualForm {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
#manualForm button {
  justify-self: start;
}
.source-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 16px 0;
}
.source-details dt {
  font-size: 12px;
  color: var(--ink-3);
}
.source-details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.restore-label {
  margin-top: 14px;
  display: inline-flex;
}
.permission-list {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

/* ---------- Pencereler ---------- */
dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
}
dialog::backdrop {
  background: rgb(10 20 30 / 55%);
}
dialog form,
.rate-import-dialog {
  display: grid;
  gap: 14px;
}
.rate-import-dialog[open] {
  display: grid;
  width: min(900px, calc(100vw - 24px));
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.filebox {
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.filebox small {
  color: var(--ink-3);
  font-weight: 500;
}
.sheet-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sheet-list legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
}
.sheet-actions {
  display: flex;
  gap: 4px;
}
.document-dialog[open] {
  display: flex;
  flex-direction: column;
  width: min(900px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  padding: 0;
  overflow: hidden;
}
.document-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
}
.quote-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #e9edf1;
}

/* ---------- Giriş ekranı ---------- */
.auth-screen {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(400px, 100%);
  display: grid;
  gap: 14px;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-size: 22px;
}
.auth-card small {
  color: var(--ink-3);
  text-align: center;
}
.auth-mark {
  justify-self: start;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.auth-mark span {
  margin-left: 6px;
  color: var(--accent);
}

/* ---------- Teklif önizlemesi (ekranda A4 kâğıt; çıktı print.css ile) ---------- */
.quote-preview {
  padding: 24px;
  background: var(--surface-3);
  border-radius: var(--radius);
  overflow-x: auto;
}
.quote-paper {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 56px;
  background: #fff;
  color: #263d50;
  box-shadow: 0 2px 12px rgb(0 0 0 / 12%);
  font-size: 13px;
}
.quote-paper h2,
.quote-paper h3 {
  color: #1d3448;
}
.quote-paper p {
  color: #748695;
}
.quote-topline {
  height: 4px;
  margin: -48px -56px 32px;
  background: #2a465c;
}
.quote-letterhead {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #d9e2e8;
}
.quote-company {
  display: grid;
  gap: 10px;
}
.quote-company p {
  font-size: 12px;
}
.quote-logo {
  width: 170px;
  height: 80px;
  object-fit: contain;
  object-position: left;
}
.quote-monogram {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  background: #28475f;
  color: #fff;
  font-size: 24px;
}
.quote-doc-title {
  text-align: right;
}
.quote-doc-title > span {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #8998a4;
}
.quote-meta {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
}
.quote-meta h3 {
  margin: 8px 0 4px;
  font-size: 16px;
}
.quote-meta dl {
  min-width: 220px;
  margin: 0;
  font-size: 12px;
}
.quote-meta dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.quote-meta dt {
  color: #8a9aa7;
}
.quote-meta dd {
  margin: 0;
}
.quote-paper .doc-label {
  color: #8d9ca7;
}
.quote-lines th {
  background: #f0f4f7;
  color: #738998;
  border-bottom-color: #dde5eb;
}
.quote-lines td {
  border-bottom: 1px solid #e6edf2;
  vertical-align: top;
}
.quote-lines tbody tr:last-child td {
  border-bottom: 1px solid #e6edf2;
}
.quote-lines tbody tr:hover td {
  background: transparent;
}
.quote-lines small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #8d9fab;
}
.quote-lines .row-no {
  color: #a3afb8;
}
.quote-bottom {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
}
.quote-terms {
  flex: 1;
}
.quote-terms p {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
}
.quote-totals {
  width: 260px;
  flex: none;
}
.quote-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 12px;
  color: #8295a3;
}
.quote-totals strong {
  color: #29485e;
}
.quote-totals .grand-total {
  margin: 4px 0 8px;
  padding: 14px 12px;
  background: #f0f5f8;
}
.grand-total > strong {
  font-size: 18px;
  white-space: nowrap;
}
.quote-totals > small {
  display: block;
  text-align: right;
  font-size: 10px;
  color: #9ba8b2;
}
.quote-signatures {
  display: flex;
  justify-content: flex-end;
  padding: 32px 0 20px;
}
.quote-signatures > div {
  width: 45%;
  padding-top: 10px;
  border-top: 1px solid #dfe7ed;
  font-size: 11px;
  color: #8da0ae;
}
.quote-signatures span {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #647f91;
}
.quote-document-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid #e3eaf0;
  font-size: 10px;
  color: #9cabb6;
}

/* ---------- Dar masaüstü ---------- */
@media (max-width: 1100px) {
  :root {
    --aside: 220px;
  }
  main {
    padding: 24px 20px;
  }
  .basket-layout,
  .permission-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sticky-summary {
    position: static;
  }
  .calculation-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .company-settings {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Tablet ve telefon ---------- */
@media (max-width: 860px) {
  body {
    display: block;
  }
  /* Üst çubuk + açılır menü */
  aside {
    position: sticky;
    top: 0;
    height: auto;
    max-height: 100vh;
    padding: 8px 16px;
    gap: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  .aside-head {
    justify-content: space-between;
    min-height: 48px;
  }
  .brand {
    flex-direction: row;
    padding: 0;
    gap: 10px;
    text-align: left;
  }
  .company-logo {
    max-width: 96px;
    max-height: 36px;
  }
  .company-logo.plate {
    padding: 4px 8px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
  .brand-name {
    font-size: 14px;
  }
  .brand-name small {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }
  .menu-toggle svg {
    width: 22px;
    height: 22px;
  }
  .aside-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: calc(100vh - 65px);
    overflow-y: auto;
    padding: 8px 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 32px rgb(0 0 0 / 18%);
  }
  body.menu-open .aside-menu {
    display: flex;
  }
  nav button {
    min-height: 48px;
    font-size: 15px;
  }
  main {
    min-height: calc(100vh - 65px);
    padding: 16px;
  }
  header {
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 14px;
  }
  h1 {
    font-size: 20px;
  }
  .page-head p {
    display: none;
  }
  .header-actions button {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
  }
  #view {
    gap: 12px;
  }
  .panel {
    padding: 16px;
  }
  .table-panel {
    padding: 0;
  }
  .toolbar {
    padding: 12px;
  }
  .toolbar h3 {
    flex: 1 1 100%;
  }
  .toolbar > input,
  .toolbar > select,
  .search-box {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }
  .form-grid,
  .form-grid.three,
  .settings-columns,
  .source-details,
  .calculation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .add-card-action {
    justify-content: space-between;
    align-items: center;
  }
  .saved-basket-bar .actions,
  .saved-basket-bar select {
    width: 100%;
  }
  .saved-basket-bar .actions > * {
    flex: 1 1 auto;
  }
  .section-heading > .actions {
    width: 100%;
  }
  .section-heading > .actions > button {
    flex: 1 1 auto;
  }
  .brand-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .logo-uploads {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  footer {
    margin-top: 20px;
  }

  /* Özet kartları: yan yana, kısa */
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 10px 12px;
    gap: 2px;
  }
  .metric > span {
    font-size: 11px;
    line-height: 1.3;
  }
  .metric > strong {
    font-size: 16px;
  }
  .metric > small {
    display: none;
  }

  /* Tablolar → kartlar (oran tablosu ve teklif kâğıdı hariç) */
  .table-scroll {
    overflow: visible;
  }
  .table-scroll table:not(.rates-table),
  .table-scroll table:not(.rates-table) tbody,
  .table-scroll table:not(.rates-table) tr,
  .table-scroll table:not(.rates-table) td {
    display: block;
    width: auto !important;
    min-width: 0 !important;
    height: auto;
  }
  .table-scroll table:not(.rates-table) colgroup,
  .table-scroll table:not(.rates-table) thead {
    display: none;
  }
  .table-scroll table:not(.rates-table) tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .table-scroll table:not(.rates-table) tbody tr:last-child {
    border-bottom: 0;
  }
  .table-scroll table:not(.rates-table) td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    background: transparent !important;
  }
  .table-scroll table:not(.rates-table) td::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: 0.04em;
    color: var(--ink-3);
  }
  .table-scroll table:not(.rates-table) td[data-label='']::before {
    display: none;
  }
  /* İlk hücre kartın başlığıdır, tüm satırı kaplar */
  .table-scroll table:not(.rates-table) td:first-child {
    grid-column: 1 / -1;
  }
  .table-scroll table:not(.rates-table) td:first-child::before {
    display: none;
  }
  /* Katalog kartı: fiyatlar tek satırda */
  .table-scroll table.catalog-table tr {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .table-scroll table.catalog-table td:nth-child(2) {
    grid-column: span 2;
  }
  .table-scroll table.catalog-table td:first-child {
    grid-column: 1 / -1;
  }
  .table-scroll table:not(.rates-table) td.empty {
    grid-column: 1 / -1;
    align-items: center;
    text-align: center;
  }
  .table-scroll td:empty {
    display: none !important;
  }
  .table-scroll .list-name {
    max-width: 100%;
  }
  .table-scroll td > select,
  .table-scroll td > .amount-input {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .table-scroll td:has(> .remove) {
    align-items: flex-end;
  }
  .table-scroll .row-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
  .table-scroll .row-actions {
    justify-content: stretch;
    padding-top: 8px;
  }
  .table-scroll .row-actions > * {
    flex: 1;
  }
  .selected-bank-row {
    background: var(--selected);
  }
  .table-foot {
    flex-wrap: wrap;
  }
  .filter-strip {
    padding: 10px 12px;
  }
  .toolbar {
    position: relative;
  }
  .column-options {
    position: static;
  }
  .column-menu {
    left: 12px;
    right: 12px;
    width: auto;
  }

  /* Teklif kâğıdı akışkan */
  .quote-preview {
    padding: 0;
    background: transparent;
  }
  .quote-paper {
    padding: 24px 18px;
    font-size: 12px;
  }
  .quote-topline {
    margin: -24px -18px 20px;
  }
  .quote-letterhead,
  .quote-meta,
  .quote-bottom {
    flex-direction: column;
    gap: 14px;
  }
  .quote-doc-title {
    text-align: left;
  }
  .quote-meta dl,
  .quote-totals {
    width: 100%;
    min-width: 0;
  }
  .quote-lines th,
  .quote-lines td {
    padding: 8px 4px;
  }
  .quote-lines th:first-child,
  .quote-lines td:first-child {
    display: none;
  }
  .quote-signatures > div {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .theme-toggle span,
  #uploadOpen span {
    display: none;
  }
  .metric > strong {
    font-size: 14px;
  }
  .brand-choices {
    grid-template-columns: minmax(0, 1fr);
  }
  dialog {
    padding: 18px;
  }
}

/* ---------- Yazdırma (ana sayfa) ---------- */
@media print {
  aside,
  header,
  footer,
  .no-print,
  #notice {
    display: none !important;
  }
  body {
    display: block;
    background: #fff;
  }
  main {
    padding: 0;
  }
  .quote-preview {
    padding: 0;
    background: none;
  }
  .quote-paper {
    box-shadow: none;
  }
}
