/*
  Gider Takibi v17.2.6 visual system adapted for Kaşe Hesaplama.
  Presentation only. No calculation, storage or interaction rules live here.
*/

:root {
  --font-ui: "din-2014", "DIN 2014", "Liberation Sans Narrow", "Arial Narrow", sans-serif;
  --font-title: var(--font-ui);
  --font-label: var(--font-ui);
  --font-button: var(--font-ui);
  --font-display: "proxima-nova-extra-wide", "Arial Black", sans-serif;
  --font-num: "nitti", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --ui-shell-bg: color-mix(in srgb, var(--surface) 56%, var(--bg));
  --ui-card-bg: color-mix(in srgb, var(--surface) 88%, var(--bg));
  --ui-card-bg-active: color-mix(in srgb, var(--surface) 97%, var(--bg));
  --ui-control-bg: color-mix(in srgb, var(--bg) 58%, var(--surface));
  --ui-control-bg-hover: color-mix(in srgb, var(--text) 5%, var(--ui-control-bg));
  --ui-segment-bg: color-mix(in srgb, var(--surface) 68%, var(--bg));
  --ui-divider: color-mix(in srgb, var(--border) 72%, transparent);
  --ui-border: color-mix(in srgb, var(--border) 86%, transparent);
  --ui-border-strong: color-mix(in srgb, var(--text) 22%, var(--border));

  --ui-radius-shell: 10px;
  --ui-radius-card: 8px;
  --ui-radius-control: 6px;
  --ui-radius-field: 4px;

  --ui-control-height: 32px;
  --ui-control-height-sm: 28px;
  --ui-icon-control: 28px;

  --ui-font-section: 10px;
  --ui-font-label: 9px;
  --ui-font-meta: 9px;
  --ui-font-body: 12px;
  --ui-font-button: 9px;
  --ui-font-value: 12px;
}

html.dark-mode {
  --surface-muted: #211f1b;
  --line: #3a3731;
  --section-line: #3a3731;
  --text-muted: #9a958c;
}

html,
body,
#mainApp,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
  font-synthesis: none;
}

body {
  transition: background-color .15s ease, color .15s ease;
}

.numeric,
.r-val,
.rt-val,
.rk-val,
.dc-val,
.ak-item,
.vb-hint,
.wc-num,
input[type="number"],
input[type="date"],
.kur-inline,
.kur-inline-input,
.pb-row,
.sp-val,
.sp-hint,
.result-eur,
.dc-sub,
.dc-sub-fx,
.ak-dates,
.ak-status,
.ak-pasif-btn,
.ak-item-live-try {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

/* Reference app has no ticker. Keep markup inert for compatibility. */
#ticker-banner {
  display: none !important;
}

.container {
  width: calc(100% - 28px);
  max-width: 860px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 0 24px;
}

/* Header */
.header {
  gap: 12px;
  margin-bottom: 12px;
  padding: 6px 0 0;
}

.header-title,
.lock-display {
  font-family: var(--font-display);
}

.header-title {
  margin-bottom: 4px;
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -1px;
}

.header-eyebrow,
.header-sub,
.lock-title,
.lock-sub,
.conn-indicator {
  font-family: var(--font-num);
}

.header-eyebrow {
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 3px;
}

.header-sub {
  gap: 10px;
  font-size: 9px;
  letter-spacing: 1px;
}

.header-actions {
  gap: 8px;
}

.theme-toggle,
.settings-toggle {
  width: var(--ui-control-height);
  height: var(--ui-control-height);
  min-width: var(--ui-control-height);
  min-height: var(--ui-control-height);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  background: var(--ui-card-bg);
  box-shadow: none;
}

.conn-indicator {
  border-radius: var(--ui-radius-field);
  background: var(--surface-muted);
  font-size: 8px;
  font-weight: 400;
}

/* Lock screen */
#lockScreen {
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 20px;
}

.lock-card {
  max-width: 420px;
  padding: 36px 30px 28px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  background: var(--ui-card-bg-active);
  box-shadow: none;
}

/* Login theme control shares the exact header-tool anchor of the app shell. */
.lock-theme-toggle {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top, 0px));
  right: max(14px, calc((100vw - 860px) / 2));
  z-index: 1002;
}

.lock-display {
  font-size: clamp(28px, 7vw, 44px);
  font-weight: 900;
  line-height: .92;
  letter-spacing: -1.5px;
}

.lock-title {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 3px;
}

.lock-sub {
  font-size: 9px;
  letter-spacing: 1.5px;
}

.lock-input {
  min-height: 34px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid var(--ui-divider);
  border-radius: var(--ui-radius-field) var(--ui-radius-field) 0 0;
  background: var(--ui-control-bg);
  font-family: var(--font-num);
  box-shadow: none;
}

.lock-input:focus {
  border-bottom-color: var(--text);
  box-shadow: inset 0 -1px 0 var(--text);
}

.lock-btn {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: var(--ui-radius-control);
  font-family: var(--font-button);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.lock-btn.primary {
  background: var(--text);
  color: var(--surface);
}

.lock-btn.secondary {
  border-color: var(--ui-border);
  background: transparent;
}

/* Primary navigation */
.tabs {
  align-items: stretch;
  gap: 4px;
  min-height: 38px;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  min-height: 38px;
  padding: 9px 12px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tab-btn.active,
html.dark-mode .tab-btn.active {
  border-bottom-color: var(--text);
  color: var(--text);
}

/* Shells and cards */
.card,
.result-card,
.intl-section-card,
#alacakDash.dash-grid {
  border: 0;
  border-radius: var(--ui-radius-card);
  background: var(--ui-card-bg);
  box-shadow: none;
}

.card,
.result-card,
.intl-section-card {
  padding: 11px;
  margin-bottom: 8px;
}

.card:hover,
.result-card:hover,
.intl-section-card:hover {
  border-color: transparent;
}

.card > .card-title:first-child,
.intl-section-card > .card-title:first-child,
.result-card > .card-title:first-child {
  min-height: 39px;
  display: flex;
  align-items: center;
  margin: -11px -11px 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--ui-divider);
}


.card > .form-toggle-header:first-child {
  min-height: 39px;
  margin: -11px -11px 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--ui-divider);
}

.card-title,
.settings-title,
.pdf-preview-kicker,
.dc-label,
.field-label,
.alt-vade-label {
  font-family: var(--font-label);
  font-size: var(--ui-font-section);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.card-title {
  color: var(--text);
}

.card > .card-title:not(:first-child) {
  margin: 10px 0 7px;
  padding-top: 9px;
  border-top: 1px solid var(--ui-divider);
}

.divider {
  border-top-color: var(--ui-divider);
}

/* Form labels and fields */
.field-label,
.settings-field-label {
  color: var(--text-muted);
  font-size: var(--ui-font-label);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .035em;
}

.input-group {
  gap: 4px;
}

input[type="number"],
input[type="text"],
input[type="date"],
select,
.intl-ot-select-button,
.settings-field input {
  min-height: var(--ui-control-height);
  height: var(--ui-control-height);
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid var(--ui-divider);
  border-radius: var(--ui-radius-field) var(--ui-radius-field) 0 0;
  background: var(--ui-control-bg);
  color: var(--text);
  box-shadow: none;
  outline: 0;
}

input[type="number"],
input[type="text"],
input[type="date"],
.settings-field input {
  font-family: var(--font-num);
  font-size: var(--ui-font-body);
  font-weight: 400;
}

select,
.intl-ot-select-button {
  font-family: var(--font-ui);
  font-size: var(--ui-font-body);
  font-weight: 400;
}

input:focus,
select:focus,
.intl-ot-select-button:focus-visible,
.intl-ot-select-button[aria-expanded="true"] {
  border-bottom-color: var(--text);
  box-shadow: inset 0 -1px 0 var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--dim-soft);
  opacity: 1;
}

.alacak-date-row input[type="date"] {
  min-height: var(--ui-control-height);
  height: var(--ui-control-height);
  padding: 6px 7px;
  font-size: 10px;
}

.input-hint,
.intl-overtime-hint,
.intl-perdiem-hint,
.intl-fx-box-hint,
.settings-sub,
.sp-label,
.empty-state {
  font-family: var(--font-num);
  font-size: var(--ui-font-meta);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
}

/* Shared controls */
.btn,
.ak-btn,
.kdv-btn,
.hft-btn,
.wc-btn,
.form-toggle-chevron,
.intl-ot-select-menu button,
.btn-sync-inline {
  min-height: var(--ui-control-height);
  height: var(--ui-control-height);
  padding: 0 11px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  background: transparent;
  color: var(--text);
  font-family: var(--font-button);
  font-size: var(--ui-font-button);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .045em;
  text-transform: uppercase;
  box-shadow: none;
}

.btn:hover,
.ak-btn:hover,
.kdv-btn:hover,
.hft-btn:hover,
.wc-btn:hover,
.form-toggle-chevron:hover,
.intl-ot-select-menu button:hover {
  opacity: 1;
  border-color: var(--ui-border-strong);
  background: var(--ui-control-bg-hover);
}

.btn-dark,
.lock-btn.primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.btn-outline {
  border-color: var(--ui-border);
  background: var(--ui-control-bg);
}

.btn-row {
  gap: 7px;
  margin-top: 10px;
}

.form-toggle-chevron {
  width: var(--ui-icon-control);
  min-width: var(--ui-icon-control);
  padding: 0;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.wc-btn {
  width: var(--ui-control-height);
  min-width: var(--ui-control-height);
  padding: 0;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

.ak-btn {
  min-height: var(--ui-control-height-sm);
  height: var(--ui-control-height-sm);
  padding: 0 9px;
}

/* Segmented choices */
.vade-grid {
  gap: 7px;
}

.vade-btn {
  position: relative;
  min-height: 58px;
  padding: 10px 11px;
  border: 0;
  border-radius: var(--ui-radius-control);
  background: var(--ui-control-bg);
  color: var(--text);
  box-shadow: none;
  text-align: left;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.vade-btn:hover {
  background: var(--ui-control-bg-hover);
}

html.dark-mode .vade-btn:not(.active) {
  background: var(--ui-control-bg);
  color: var(--text);
}

html.dark-mode .vade-btn:not(.active):hover {
  background: var(--ui-control-bg-hover);
}

.vade-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.vade-btn.active,
html.dark-mode .vade-btn.active {
  border: 0;
  background: var(--text);
  color: var(--surface);
  box-shadow: none;
}

.vade-btn.active::after {
  content: none;
}

.vade-btn-manual {
  border: 0;
}

.vb-label {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.vb-hint {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}

.vade-btn:not(.active) .vb-hint {
  color: var(--text-muted);
  opacity: 1;
}

.vade-btn.active .vb-hint {
  color: inherit;
  opacity: .78;
}

.hft-toggle-group,
.kdv-options {
  gap: 6px;
}

.hft-btn,
.kdv-btn {
  background: var(--ui-control-bg);
  color: var(--text-muted);
}

.hft-btn.active,
.kdv-btn.active,
html.dark-mode .hft-btn.active,
html.dark-mode .kdv-btn.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

/* Switches */
.toggle {
  width: 28px;
  height: 18px;
}

.toggle-track {
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-muted) 28%, var(--ui-control-bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 12%, transparent);
}

.toggle-thumb {
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px color-mix(in srgb, #000 28%, transparent);
}

.toggle input:checked + .toggle-track {
  background: var(--success);
  box-shadow: none;
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(10px);
}

.toggle-label {
  font-size: var(--ui-font-body);
  font-weight: 400;
}

.toggle-sub {
  font-size: var(--ui-font-meta);
  font-weight: 400;
  letter-spacing: 0;
}

/* Results */
.result-card {
  background: var(--ui-card-bg-active);
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--text) 12%, transparent);
}

.result-line {
  min-height: 34px;
  padding: 7px 0;
}

.result-line + .result-line {
  border-top-color: var(--ui-divider);
}

.r-label,
.result-line.secondary .r-label {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--ui-font-body);
  font-weight: 400;
  letter-spacing: 0;
}

.r-val,
.result-line.secondary .r-val {
  font-family: var(--font-num);
  font-size: var(--ui-font-value);
  font-weight: 400;
}

.result-total {
  min-height: 48px;
  padding: 10px 0 5px;
  border-top-color: var(--text);
}

.rt-label,
.rk-label {
  font-family: var(--font-label);
  font-size: var(--ui-font-section);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.rt-val {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0;
}

.result-kar {
  min-height: 42px;
  margin-top: 8px;
  padding-top: 9px;
  border-top-color: var(--ui-divider);
}

.rk-val {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 400;
}

.musteri-notu,
.result-warn,
.alt-vade-box,
.preview-box {
  border-radius: 0 var(--ui-radius-field) var(--ui-radius-field) 0;
}

.musteri-notu,
.preview-box {
  background: color-mix(in srgb, var(--blue-mute) 4%, var(--ui-control-bg));
}

/* Receivables dashboard */
#alacakDash.dash-grid {
  gap: 6px;
  margin: 0 0 10px;
  padding: 10px;
  border: 0;
  border-radius: var(--ui-radius-shell);
  background: var(--ui-shell-bg);
  overflow: visible;
}

#alacakDash .dash-cell,
#alacakDash .dash-cell:nth-child(odd):not(.wide) {
  min-height: 86px;
  padding: 11px;
  border: 0;
  border-radius: var(--ui-radius-card);
  background: var(--ui-card-bg);
}

#alacakDash .dash-cell-selected {
  background: color-mix(in srgb, var(--danger) 5%, var(--ui-card-bg-active));
  box-shadow: inset 3px 0 0 var(--danger);
}

#alacakDash .dash-cell-pasif {
  border: 0;
  background: var(--ui-control-bg);
  opacity: .62;
}

.dc-label {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: var(--ui-font-label);
  font-weight: 600;
  letter-spacing: .035em;
}

.dc-val {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0;
}

.dc-sub,
.dc-sub-fx {
  font-size: var(--ui-font-meta);
  font-weight: 400;
  line-height: 1.35;
}

.dc-badge,
.ak-status,
.ak-pasif-btn {
  border-radius: var(--ui-radius-field);
  font-family: var(--font-label);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
}

/* Receivables remain a ledger, like the reference data-entry lists. */
.alacak-card {
  min-height: 0;
  padding: 10px 4px 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--ui-divider);
  border-left: 2px solid var(--text-muted);
  border-radius: 0;
  background: transparent;
}

.alacak-card.alindi {
  border-left-color: var(--success);
}

.alacak-card.selected {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 4%, transparent);
}

.ak-name {
  font-family: var(--font-ui);
  font-size: var(--ui-font-body);
  font-weight: 600;
  letter-spacing: 0;
}

.ak-dates {
  font-size: var(--ui-font-meta);
  letter-spacing: 0;
}

.ak-item,
.ak-item.ak-item-major {
  font-size: var(--ui-font-value);
  font-weight: 400;
}

.ak-item-label {
  color: var(--text-muted);
}

.ak-item-live-try {
  font-size: var(--ui-font-meta);
}

.ak-checkbox-box {
  width: 16px;
  height: 16px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-field);
}

.ak-checkbox input:checked + .ak-checkbox-box {
  background: var(--danger);
  border-color: var(--danger);
}

/* Menus and overlays */
.intl-ot-select-menu,
.settings-panel,
.pdf-preview-modal {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  background: var(--ui-card-bg-active);
  box-shadow: 0 12px 32px color-mix(in srgb, #000 14%, transparent);
}

.intl-ot-select-menu {
  padding: 5px;
}

.intl-ot-select-menu button {
  min-height: var(--ui-control-height);
  height: auto;
  border: 0;
  text-align: left;
}

.intl-ot-select-menu button:hover,
.intl-ot-select-menu button.selected {
  background: var(--ui-control-bg-hover);
}

.settings-panel {
  border-radius: var(--ui-radius-shell) var(--ui-radius-shell) 0 0;
}

.settings-title {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .045em;
}

.settings-preview {
  border-radius: var(--ui-radius-control);
  background: var(--ui-control-bg);
}

.pdf-preview-head {
  border-bottom-color: var(--ui-divider);
}

.pdf-preview-title {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: -.035em;
}

html.dark-mode input,
html.dark-mode select,
html.dark-mode .lock-input,
html.dark-mode .intl-ot-select-button {
  border: 0;
  border-bottom: 1px solid var(--ui-divider);
  background: var(--ui-control-bg);
}

html.dark-mode .theme-toggle,
html.dark-mode .settings-toggle,
html.dark-mode .settings-panel {
  background: var(--ui-card-bg-active);
}

html.dark-mode .btn-dark,
html.dark-mode .lock-btn.primary,
html.dark-mode .hft-btn.active,
html.dark-mode .kdv-btn.active {
  background: var(--text);
  color: var(--surface);
}

@media (max-width: 760px) {
  :root {
    --ui-shell-bg: transparent;
  }

  .container {
    width: calc(100% - 20px);
    padding: calc(8px + env(safe-area-inset-top, 0px)) 0 18px;
  }

  .lock-theme-toggle {
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: 10px;
  }

  .header-title {
    font-size: clamp(20px, 5.5vw, 28px);
  }

  .tabs {
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto;
    min-width: max-content;
    padding-inline: 10px;
    font-size: 9px;
  }

  .card,
  .result-card,
  .intl-section-card {
    padding: 10px;
  }

  .card > .card-title:first-child,
  .intl-section-card > .card-title:first-child,
  .result-card > .card-title:first-child {
    margin: -10px -10px 9px;
    padding-inline: 10px;
  }


  .card > .form-toggle-header:first-child {
    margin: -10px -10px 9px;
    padding-inline: 10px;
  }

  #alacakDash.dash-grid {
    padding: 0;
    background: transparent;
  }

  #alacakDash .dash-cell,
  #alacakDash .dash-cell:nth-child(odd):not(.wide) {
    min-height: 78px;
    padding: 10px;
  }

  .vade-btn {
    min-height: 54px;
  }
}

@media (max-width: 600px) {
  .dash-grid,
  #alacakDash.dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #alacakDash .dash-cell.wide {
    grid-column: 1 / -1;
  }

  .dc-val {
    font-size: 15px;
  }

  .ak-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  .vade-grid,
  .input-row,
  .intl-overtime-custom-row,
  .settings-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .dash-grid,
  #alacakDash.dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #alacakDash .dash-cell.wide {
    grid-column: auto;
  }

  .ak-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* v8.19.4 — softened dark theme with measured accessibility targets */
html.dark-mode {
  --bg: #191917;
  --surface: #22211e;
  --surface-muted: #2a2824;
  --border: #47443d;
  --line: #3d3a34;
  --section-line: #3d3a34;
  --text: #d8d4cb;
  --text-muted: #aaa59c;
  --dim: #918c83;
  --dim-soft: #817c74;
  --accent: #d8d4cb;
  --accent-warm: #c87645;
  --success: #6f9f84;
  --warning: #c2a252;
  --danger: #c87369;
  --blue-mute: #91a2b5;

  --ui-shell-bg: #1e1d1b;
  --ui-card-bg: #24231f;
  --ui-card-bg-active: #292722;
  --ui-control-bg: #2e2c27;
  --ui-control-bg-hover: #38352f;
  --ui-segment-bg: #292722;
  --ui-divider: #3d3a34;
  --ui-border: #47443d;
  --ui-border-strong: #6b665d;

  --ui-dark-selected-bg: #716c63;
  --ui-dark-selected-text: #f2eee6;
  --ui-dark-focus: #aaa59c;
}

/* Keep fields readable without returning to pure-white contrast. */
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea,
html.dark-mode .lock-input,
html.dark-mode .intl-ot-select-button,
html.dark-mode .settings-field input {
  background: var(--ui-control-bg);
  color: var(--text);
  border-bottom-color: var(--ui-divider);
}

html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder {
  color: #979289;
}

html.dark-mode input:focus,
html.dark-mode select:focus,
html.dark-mode textarea:focus,
html.dark-mode .lock-input:focus,
html.dark-mode .intl-ot-select-button:focus-visible,
html.dark-mode .intl-ot-select-button[aria-expanded="true"] {
  border-bottom-color: var(--ui-dark-focus);
  box-shadow: inset 0 -1px 0 var(--ui-dark-focus);
}

/* Primary actions and selected choices use the same moderate-contrast state. */
html.dark-mode .btn-dark,
html.dark-mode .lock-btn.primary,
html.dark-mode .vade-btn.active,
html.dark-mode .hft-btn.active,
html.dark-mode .kdv-btn.active {
  border-color: transparent;
  background: var(--ui-dark-selected-bg);
  color: var(--ui-dark-selected-text);
}

html.dark-mode .vade-btn.active .vb-label,
html.dark-mode .vade-btn.active .vb-hint {
  color: var(--ui-dark-selected-text);
  opacity: 1;
}

html.dark-mode .btn-dark:hover,
html.dark-mode .lock-btn.primary:hover,
html.dark-mode .vade-btn.active:hover,
html.dark-mode .hft-btn.active:hover,
html.dark-mode .kdv-btn.active:hover {
  background: #746f66;
  color: #fffdf6;
}

/* Secondary controls stay distinct through surface hierarchy, not bright outlines. */
html.dark-mode .btn-outline,
html.dark-mode .ak-btn:not(.received):not(.del),
html.dark-mode .hft-btn:not(.active),
html.dark-mode .kdv-btn:not(.active),
html.dark-mode .vade-btn:not(.active),
html.dark-mode .form-toggle-chevron,
html.dark-mode .theme-toggle,
html.dark-mode .settings-toggle,
html.dark-mode .btn-sync-inline {
  border-color: var(--ui-border);
  background: var(--ui-control-bg);
  color: #c9c4bb;
}

html.dark-mode .btn-outline:hover,
html.dark-mode .ak-btn:not(.received):not(.del):hover,
html.dark-mode .hft-btn:not(.active):hover,
html.dark-mode .kdv-btn:not(.active):hover,
html.dark-mode .vade-btn:not(.active):hover,
html.dark-mode .form-toggle-chevron:hover,
html.dark-mode .theme-toggle:hover,
html.dark-mode .settings-toggle:hover,
html.dark-mode .btn-sync-inline:hover {
  border-color: var(--ui-border-strong);
  background: var(--ui-control-bg-hover);
  color: var(--text);
}

html.dark-mode .tab-btn {
  color: var(--dim);
}

html.dark-mode .tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--dim);
}

html.dark-mode .intl-ot-select-menu button.selected {
  background: var(--ui-dark-selected-bg);
  color: var(--ui-dark-selected-text);
}

html.dark-mode .intl-ot-select-menu button.selected:hover {
  background: #746f66;
  color: #fffdf6;
}

html.dark-mode .toggle-track {
  background: #403d37;
  box-shadow: inset 0 0 0 1px var(--ui-border);
}

html.dark-mode .toggle-thumb {
  background: #cbc6bd;
}

html.dark-mode .toggle input:checked + .toggle-track {
  background: #537b68;
}

html.dark-mode .vade-btn:focus-visible,
html.dark-mode .btn:focus-visible,
html.dark-mode .ak-btn:focus-visible,
html.dark-mode .hft-btn:focus-visible,
html.dark-mode .kdv-btn:focus-visible,
html.dark-mode .tab-btn:focus-visible {
  outline: 2px solid var(--ui-dark-focus);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  html.dark-mode {
    --ui-shell-bg: transparent;
  }
}

html.dark-mode .lock-btn.primary:hover {
  opacity: 1;
}

/* v8.19.5 · receivable entry and source-edit states */
.source-edit-bar {
  position: sticky;
  top: 8px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 var(--ui-gap-card);
  padding: 10px 10px 10px 12px;
  border: 0;
  border-radius: var(--ui-radius-card);
  background: var(--ui-dark-selected-bg, var(--text));
  color: var(--ui-dark-selected-text, var(--surface));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--bg) 24%, transparent);
}

.source-edit-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.source-edit-kicker {
  flex: 0 0 auto;
  font-family: var(--font-label);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
  opacity: .78;
}

.source-edit-name {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: var(--ui-font-body);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-edit-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--ui-radius-field);
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: inherit;
  font-family: var(--font-ui);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.source-edit-close:hover {
  background: color-mix(in srgb, currentColor 20%, transparent);
}

.source-edit-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

#alacakFormCard {
  margin-bottom: var(--ui-gap-card);
}

#alacakFormCard .form-body {
  display: block;
}

.alacak-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.alacak-entry-source {
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--font-num);
  font-size: var(--ui-font-meta);
  font-variant-numeric: tabular-nums;
}

.alacak-entry-close {
  background: var(--ui-control-bg);
  color: var(--text-muted);
}

.alacak-entry-close:hover {
  background: var(--ui-control-bg-hover);
  color: var(--text);
}

.ak-live-rate {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

html.dark-mode .source-edit-bar {
  background: var(--ui-dark-selected-bg);
  color: var(--ui-dark-selected-text);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

@media (max-width: 560px) {
  .source-edit-bar {
    top: 6px;
    padding: 9px 8px 9px 10px;
  }

  .source-edit-copy {
    display: block;
  }

  .source-edit-kicker,
  .source-edit-name {
    display: block;
  }

  .source-edit-name {
    margin-top: 2px;
  }

  .ak-live-rate {
    display: block;
    margin-top: 2px;
  }
}

.dash-fx-warning {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: var(--ui-radius-field);
  background: var(--ui-control-bg);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--ui-font-meta);
  line-height: 1.35;
}

.dash-fx-warning-selected {
  background: var(--ui-card-bg-active);
}

html.dark-mode .dash-fx-warning {
  background: var(--ui-control-bg);
  color: var(--text-muted);
}

/* v8.19.6 · receivable due-date and advance operations */
.receivable-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(8px);
}

.receivable-action-overlay.open {
  display: flex;
}

.receivable-action-modal {
  width: min(480px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: 16px;
  border: 0;
  border-radius: var(--ui-radius-card);
  background: var(--ui-card-bg);
  color: var(--text);
  box-shadow: 0 22px 70px color-mix(in srgb, var(--bg) 56%, transparent);
}

.receivable-action-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.receivable-action-kicker {
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.receivable-action-title {
  margin-top: 3px;
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 600;
}

.receivable-action-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--font-num);
  font-size: var(--ui-font-meta);
}

.receivable-action-close {
  background: var(--ui-control-bg);
  color: var(--text-muted);
}

.receivable-action-close:hover {
  background: var(--ui-control-bg-hover);
  color: var(--text);
}

.receivable-action-section .input-row + .input-row {
  margin-top: 9px;
}

.receivable-action-buttons {
  display: flex;
  gap: 7px;
  margin-top: 14px;
}

.receivable-action-error {
  min-height: 16px;
  margin-top: 8px;
  color: var(--danger);
  font-family: var(--font-num);
  font-size: var(--ui-font-meta);
}

.receivable-advance-preview {
  min-height: 16px;
  margin-top: 9px;
  color: var(--text-muted);
  font-family: var(--font-num);
  font-size: var(--ui-font-meta);
  font-variant-numeric: tabular-nums;
}

.ak-item-advance .ak-item-label,
.ak-item-advance .ak-money-main {
  color: var(--success);
}

.ak-item-remaining .ak-money-main {
  font-weight: 700;
}

.ak-advance-ledger {
  margin: 8px 0 2px 24px;
  padding: 7px 0 2px;
  border-top: 1px solid var(--ui-divider);
}

.ak-advance-ledger-title {
  margin-bottom: 3px;
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.ak-advance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  color: var(--text-muted);
  font-family: var(--font-num);
  font-size: var(--ui-font-meta);
  font-variant-numeric: tabular-nums;
}

.ak-advance-date,
.ak-advance-amount,
.ak-advance-note {
  display: inline;
}

.ak-advance-date::after,
.ak-advance-amount::after {
  content: " · ";
  color: var(--dim);
}

.ak-advance-note:last-child::after,
.ak-advance-amount:last-child::after {
  content: "";
}

.ak-advance-amount {
  color: var(--text);
  font-weight: 600;
}

.ak-advance-remove {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--ui-radius-field);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.ak-advance-remove:hover {
  background: var(--ui-control-bg-hover);
  color: var(--danger);
}

/* PDF is intentionally tertiary throughout the application. */
.btn.btn-pdf-subtle,
.pdf-preview-actions .btn.btn-pdf-subtle {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 22px;
  height: 22px;
  align-self: center;
  padding: 0 7px;
  border-color: transparent;
  border-radius: var(--ui-radius-field);
  background: transparent;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .035em;
  opacity: .68;
}

.btn.btn-pdf-subtle:hover,
.pdf-preview-actions .btn.btn-pdf-subtle:hover {
  border-color: transparent;
  background: var(--ui-control-bg-hover);
  color: var(--text);
  opacity: 1;
}

html.dark-mode .btn.btn-pdf-subtle,
html.dark-mode .pdf-preview-actions .btn.btn-pdf-subtle {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

html.dark-mode .receivable-action-overlay {
  background: rgba(10, 10, 9, .72);
}

@media (max-width: 560px) {
  .receivable-action-overlay {
    align-items: flex-end;
    padding: 8px;
  }

  .receivable-action-modal {
    width: 100%;
    max-height: calc(100vh - 16px);
    padding: 14px;
  }

  .receivable-action-buttons .btn {
    min-width: 0;
  }

  .ak-advance-ledger {
    margin-left: 0;
  }

  .btn.btn-pdf-subtle,
  .pdf-preview-actions .btn.btn-pdf-subtle {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 22px;
    height: 22px;
    padding: 0 7px;
    font-size: 8px;
  }
}

/* v8.19.8 · compact floating due-date and advance editors */
.receivable-action-overlay.floating-popover {
  display: none;
  padding: 0;
  align-items: initial;
  justify-content: initial;
  background: transparent;
  backdrop-filter: none;
}

.receivable-action-overlay.floating-popover.open {
  display: block;
}

.receivable-action-overlay.floating-popover .receivable-action-modal {
  position: fixed;
  width: min(320px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  padding: 14px;
  overflow: auto;
  box-shadow: 0 16px 46px color-mix(in srgb, var(--bg) 45%, transparent);
}

.receivable-action-overlay.floating-popover .receivable-action-head {
  margin-bottom: 12px;
}

.receivable-action-overlay.floating-popover .receivable-action-kicker {
  display: none;
}

.receivable-action-overlay.floating-popover .receivable-action-title {
  margin-top: 0;
  font-size: 15px;
}

.receivable-action-overlay.floating-advance .receivable-action-modal {
  width: min(420px, calc(100vw - 20px));
}

.receivable-action-overlay.floating-advance .receivable-action-kicker {
  display: block;
}

.receivable-action-overlay.floating-advance .receivable-action-title {
  font-size: 16px;
}

.receivable-action-overlay.floating-popover .receivable-action-meta {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-action-overlay.floating-popover .receivable-action-buttons {
  justify-content: flex-end;
  margin-top: 12px;
}

.receivable-action-overlay.floating-popover .receivable-action-buttons .btn {
  flex: 0 0 auto;
  min-width: 0;
}

html.dark-mode .receivable-action-overlay.floating-popover {
  background: transparent;
}

@media (max-width: 560px) {
  .receivable-action-overlay.floating-popover {
    display: none;
    padding: 0;
    align-items: initial;
  }

  .receivable-action-overlay.floating-popover.open {
    display: block;
  }

  .receivable-action-overlay.floating-popover .receivable-action-modal {
    position: fixed;
    width: min(320px, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
    padding: 14px;
  }


  .receivable-action-overlay.floating-advance .receivable-action-modal {
    width: min(420px, calc(100vw - 20px));
  }
}
