:root {
  --brand: #0f766e;
  --bg: linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
  --surface: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #f5f7fa;
  --surface-3: #edf2f7;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.62);
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --focus: rgba(15, 118, 110, 0.2);
  --danger: #d92d20;
  --success: #12b76a;
  --warning: #f79009;
  --info: #2e90fa;
  --link: #0b63d8;
  --link-hover: #084fb0;
}

[data-theme="dark"] {
  --brand: #34d399;
  --bg: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  --surface: #111b2e;
  --surface-1: #111b2e;
  --surface-2: #0f1829;
  --surface-3: #17243a;
  --text: #edf3fb;
  --muted: rgba(237, 243, 251, 0.78);
  --border: rgba(237, 243, 251, 0.2);
  --shadow: 0 16px 30px rgba(2, 8, 20, 0.55);
  --focus: rgba(52, 211, 153, 0.24);
  --link: #82cfff;
  --link-hover: #b5e2ff;
}

body {
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--link);
}

a:hover {
  color: var(--link-hover);
}

[data-theme="dark"] {
  color-scheme: dark;
}

.app-shell {
  max-width: 1180px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-bottom: 0.15rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-title {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.soft-muted {
  color: var(--muted);
}

.navbar {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
}

.navbar-brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--brand) !important;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.topbar-actions .form-select {
  min-width: 160px;
}

.btn-brand {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: color-mix(in srgb, var(--brand) 92%, #000 8%);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 92%, #000 8%);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: color-mix(in srgb, var(--brand) 85%, #000 15%);
  --bs-btn-active-border-color: color-mix(in srgb, var(--brand) 85%, #000 15%);
  --bs-btn-focus-shadow-rgb: 0, 0, 0;
}

.dropdown-item[data-set-theme].active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, var(--surface) 86%);
  font-weight: 700;
}

[data-theme="dark"] .dropdown-item[data-set-theme].active {
  color: var(--link-hover);
  background: color-mix(in srgb, var(--brand) 28%, var(--surface) 72%);
}

.btn[data-set-theme].active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.nav-pills .nav-link {
  color: var(--text);
  border-radius: 12px;
}

.nav-pills .nav-link.active {
  background: var(--brand);
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.card-header .section-title {
  font-weight: 700;
}

.badge {
  border-radius: 999px;
  padding: 0.5em 0.75em;
  font-weight: 600;
}

.table > :not(caption) > * > * {
  background: transparent;
  border-bottom-color: var(--border);
  color: var(--text);
}

.table thead th {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.form-control,
.form-select {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: 0 0 0 0.25rem var(--focus) !important;
  border-color: color-mix(in srgb, var(--brand) 55%, #fff 45%);
}

.kpi {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.kpi .icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand) 16%, var(--surface) 84%);
  border: 1px solid var(--border);
}

.kpi .value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
}

.kpi .label {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill--wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.chip {
  border: 1px solid var(--border);
  padding: 0.35rem 0.55rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 85%, var(--surface-2) 15%);
  color: var(--muted);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.js-click-card {
  cursor: pointer;
}

.filter-panel {
  border: none;
  background: transparent;
  border-radius: var(--radius);
  padding: 0;
}

.filter-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.filter-shortcuts .chip {
  font-size: 0.78rem;
}

.filter-shortcuts .chip-more {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--brand) 30%);
  color: var(--brand);
  cursor: default;
}

.filter-details {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--surface-2) 20%);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
}

.filter-details[open] {
  box-shadow: var(--shadow);
}

.filter-details summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0;
}

.file-picker {
  position: relative;
}

.js-enabled .file-picker .file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker .file-ui {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-2) 8%);
}

.file-picker.is-dragover .file-ui {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface) 90%);
}

.file-picker .file-input {
  position: static;
  width: 100%;
  height: auto;
  margin: 0 0 0.5rem 0;
  clip: auto;
  white-space: normal;
}

.js-enabled .file-picker .file-ui {
  margin-top: 0;
}

.file-picker .file-input.is-invalid ~ .file-ui {
  border-color: var(--bs-danger);
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.file-picker [data-file-name] {
  overflow-wrap: anywhere;
}

.filter-details summary::-webkit-details-marker {
  display: none;
}

.filter-body {
  padding-top: 0.75rem;
}

.filter-badges {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.summary-list {
  display: grid;
  gap: 0.75rem;
}

.expenses-summary-mobile {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 85%, var(--surface-2) 15%);
  padding: 0.5rem 0.65rem;
}

.expenses-summary-mobile summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-weight: 600;
}

.expenses-summary-mobile summary::-webkit-details-marker {
  display: none;
}

.expenses-summary-mobile .summary-total {
  color: var(--brand);
  font-weight: 700;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.summary-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.summary-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
  width: 0;
}

.timeline {
  position: relative;
  margin-left: 0.25rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.titem {
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 1.1rem;
}

.titem:last-child {
  margin-bottom: 0;
}

.titem .dot {
  position: absolute;
  left: 3px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent 88%);
}

.timeline-thumb {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: zoom-in;
}

.timeline-gallery,
.timeline-gallery-card {
  background: color-mix(in srgb, var(--surface), var(--surface-2) 40%);
  padding: 0.5rem;
  border-radius: 0.35rem;
}

.timeline-gallery-card .timeline-placeholder {
  height: 200px;
  background: color-mix(in srgb, var(--surface-1), var(--surface-2) 40%);
}

.timeline-thumb-row {
  max-width: 100%;
}

.timeline-thumb-btn {
  width: 64px;
  height: 64px;
  background: #fff;
  border: 1px solid #dee2e6;
  padding: 2px;
  border-radius: 4px;
  transition: all .2s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.timeline-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timeline-thumb-btn:hover,
.timeline-thumb-btn:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, .2);
}

.timeline-remove-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.timeline-remove-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline-remove-card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Silme kartları için daha belirgin kontrol */
.thumb-remove {
  background: #f8f9fa;
}

.thumb-remove-btn {
  min-width: 2.25rem;
}

.thumb-remove-btn.active,
.thumb-remove-btn.active:focus,
.thumb-remove-btn.active:hover {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.thumb-remove-state {
  font-size: .8rem;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-lightbox-img {
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  border-radius: 0.5rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.45);
}

.image-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.lightbox-open {
  overflow: hidden;
}

.ai-panel {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface-2);
}

.ai-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.ai-grid .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ai-grid .value {
  font-weight: 600;
}

.ai-items {
  display: grid;
  gap: 0.5rem;
}

.ai-select {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--surface);
}

.ai-select-grid {
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.ai-select .form-check {
  margin: 0;
}

.ai-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.ai-item:last-child {
  border-bottom: none;
}

.ai-amount {
  font-weight: 600;
  white-space: nowrap;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, var(--surface) 86%);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border) 60%);
  margin-left: 0.35rem;
}

.ai-badge-warn {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface) 88%);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border) 60%);
}

.receipt-no-suggestion {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  font-size: 0.78rem;
}

.receipt-no-suggestion .suggestion-text {
  font-weight: 600;
}

.btn-xs {
  --bs-btn-padding-y: 0.2rem;
  --bs-btn-padding-x: 0.45rem;
  --bs-btn-font-size: 0.72rem;
}

.receipt-no-duplicates {
  margin-top: 0.35rem;
}

.receipt-no-duplicate {
  margin-top: 0.2rem;
}

.receipt-similar-preview {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  background: var(--surface);
}

.receipt-similar-preview .preview-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  font-size: 0.85rem;
}

.receipt-similar-preview .preview-label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.receipt-similar-preview .preview-value {
  font-weight: 600;
}

.receipt-similar-preview .preview-items {
  margin-top: 0.4rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.4rem;
}

.receipt-similar-preview .preview-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.2rem 0;
}

.receipt-similar-preview .preview-item .meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.ai-empty-state {
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  border-radius: 12px;
  padding: 0.85rem;
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
}

.ai-empty-state-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.ai-empty-icon {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand) 18%, #fff);
  color: var(--brand);
  flex: 0 0 auto;
}

.ai-empty-title {
  font-weight: 700;
}

.ai-empty-text {
  margin-top: 0.15rem;
}

.ai-suggestion {
  color: var(--muted);
}

.ai-highlight {
  background-color: #fff7c2 !important;
  border-color: #f5c451 !important;
  box-shadow: 0 0 0 0.2rem rgba(245, 196, 81, 0.35) !important;
  transition: background-color 0.6s ease, box-shadow 0.6s ease;
}

.receipt-preview {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: var(--surface-2);
}

.receipt-preview .preview-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.receipt-preview .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.receipt-preview .value {
  font-weight: 600;
}

.receipt-preview .preview-image {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  background: var(--surface);
}

.receipt-preview .preview-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.receipt-preview .preview-item:last-child {
  border-bottom: none;
}

.receipt-preview .preview-amount {
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-sticky {
  position: sticky;
  top: 88px;
}

.area-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.85rem;
}

.area-group {
  margin-bottom: 0.75rem;
}

.area-group:last-child {
  margin-bottom: 0;
}

.area-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.area-options {
  display: grid;
  gap: 0.35rem;
}

.area-selected {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed var(--border);
}

.area-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.area-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.task-overdue {
  background: rgba(217, 45, 32, 0.06);
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 1rem;
}

[data-tasks-page]:not(.bulk-active) [data-bulk-cell],
[data-tasks-page]:not(.bulk-active) [data-bulk-checkbox],
[data-tasks-page]:not(.bulk-active) [data-bulk-card] {
  display: none !important;
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
}

.project-select {
  min-width: 170px;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}


.receipt-layout {
  display: grid;
  gap: 1.25rem;
  max-width: 980px;
}

.receipt-layout > * {
  min-width: 0;
}

.stepper {
  display: grid;
  gap: 1rem;
}

.stepper-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.step-num {
  opacity: 0.8;
}

.step-pill.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.step-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface);
}

.step-card.is-hidden {
  display: none;
}

.step-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.form-section {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  margin-top: 1rem;
}

.form-section summary {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
}

.form-section summary::-webkit-details-marker {
  display: none;
}

.form-section summary::after {
  content: '+';
  font-weight: 600;
  color: var(--muted);
}

.form-section[open] summary::after {
  content: '–';
}

.receipt-sidecard .ai-panel {
  margin-bottom: 1rem;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

.contracts-table .contracts-actions-col {
  white-space: nowrap;
  width: 1%;
  min-width: 132px;
}

.contracts-table .contracts-actions-col .btn {
  --bs-btn-padding-y: 0.25rem;
  --bs-btn-padding-x: 0.45rem;
}

.expense-mobile-card .expense-head {
  gap: 0.75rem;
}

.mobile-meta-block {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 0.38rem 0.55rem;
}

.mobile-meta-block summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 0.8rem;
}

.mobile-meta-block summary::-webkit-details-marker {
  display: none;
}

.mobile-meta-block[open] summary {
  margin-bottom: 0.45rem;
}

.mobile-meta-content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mobile-actions-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.mobile-actions-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
}

.mobile-actions-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-actions-menu__list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 170px;
}

.mobile-actions-menu__list .btn {
  width: 100%;
  justify-content: flex-start;
}

.timeline-show-mobile-actions .mobile-actions-menu,
.calendar-show-mobile-actions .mobile-actions-menu,
.task-show-mobile-actions .mobile-actions-menu,
.expense-show-mobile-actions .mobile-actions-menu,
.task-show-shopping-actions .mobile-actions-menu,
.expense-show-item-actions .mobile-actions-menu,
.project-show-mobile-actions .mobile-actions-menu,
.contract-show-mobile-actions .mobile-actions-menu,
.project-show-task-actions .mobile-actions-menu,
.contract-show-payment-actions .mobile-actions-menu,
.shopping-show-mobile-actions .mobile-actions-menu,
.projects-mobile-actions .mobile-actions-menu,
.timeline-form-mobile-actions .mobile-actions-menu {
  align-items: flex-end;
}

.timeline-show-mobile-actions .mobile-actions-menu__list,
.calendar-show-mobile-actions .mobile-actions-menu__list,
.task-show-mobile-actions .mobile-actions-menu__list,
.expense-show-mobile-actions .mobile-actions-menu__list,
.task-show-shopping-actions .mobile-actions-menu__list,
.expense-show-item-actions .mobile-actions-menu__list,
.project-show-mobile-actions .mobile-actions-menu__list,
.contract-show-mobile-actions .mobile-actions-menu__list,
.project-show-task-actions .mobile-actions-menu__list,
.contract-show-payment-actions .mobile-actions-menu__list,
.shopping-show-mobile-actions .mobile-actions-menu__list,
.projects-mobile-actions .mobile-actions-menu__list,
.timeline-form-mobile-actions .mobile-actions-menu__list {
  min-width: 190px;
}

.calendar-show-related summary {
  list-style: none;
  cursor: pointer;
}

.calendar-show-related summary::-webkit-details-marker {
  display: none;
}

.timeline-form-area-options .mobile-meta-content {
  display: block;
  width: 100%;
}

.task-mobile-actions .btn,
.expense-mobile-actions .btn,
.shopping-mobile-actions .btn,
.contracts-mobile-actions .btn,
.timeline-mobile-actions .btn,
.calendar-mobile-actions .btn,
.projects-mobile-actions .btn,
.timeline-show-mobile-actions .btn,
.calendar-show-mobile-actions .btn,
.task-show-mobile-actions .btn,
.expense-show-mobile-actions .btn,
.task-show-shopping-actions .btn,
.expense-show-item-actions .btn,
.project-show-mobile-actions .btn,
.contract-show-mobile-actions .btn,
.project-show-task-actions .btn,
.contract-show-payment-actions .btn,
.shopping-show-mobile-actions .btn,
.timeline-form-mobile-actions .btn {
  min-height: 36px;
  --bs-btn-padding-x: 0.7rem;
}

.expense-mobile-card .expense-vendor {
  font-size: 1rem;
  line-height: 1.3;
}

.expense-mobile-card .expense-amount {
  white-space: nowrap;
  font-size: 1rem;
  line-height: 1.2;
}

.expense-mobile-card .expense-meta-primary {
  font-size: 0.85rem;
}

.expense-mobile-card .expense-meta-secondary {
  font-size: 0.8rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

@media (min-width: 1400px) {
  .contracts-table .contracts-actions-col {
    min-width: 220px;
  }
}

@media (max-width: 1399.98px) {
  .contracts-table .contracts-actions-col .action-label {
    display: none;
  }
}

[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .offcanvas {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.offcanvas {
  background: var(--surface);
  color: var(--text);
  border-right: 1px solid var(--border);
  width: min(86vw, 320px);
}

.offcanvas-bottom {
  width: 100%;
  max-width: none;
  border-right: none;
  border-left: none;
  border-bottom: none;
}

.offcanvas.quick-actions {
  height: 70vh;
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
}

.offcanvas-header {
  border-bottom: 1px solid var(--border);
}

.offcanvas-body {
  padding-top: 0.75rem;
}

.offcanvas.quick-actions .offcanvas-body {
  overflow-y: auto;
}

.offcanvas .nav-link {
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 0.65rem 0.75rem;
}

.offcanvas .nav-link .bi {
  width: 1.25rem;
}

.navbar .dropdown-menu {
  z-index: 2000;
}

.list-group-item {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.list-group-item:hover {
  background: var(--surface-2);
}

@media (max-width: 576px) {
  .app-shell {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .navbar .container-fluid {
    gap: 0.5rem;
  }

  .navbar-brand {
    font-size: 1rem;
  }

  .navbar .btn,
  .navbar .form-select {
    font-size: 0.85rem;
  }

  .project-select {
    min-width: 0;
    max-width: 140px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.4rem;
  }

  .topbar-actions form {
    flex: 1 1 100%;
  }

  .topbar-actions .project-select {
    width: 100%;
    max-width: none;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 1rem;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .card-header,
  .card-body {
    padding: 0.75rem;
  }

  .pill,
  .chip {
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
  }

  .kpi .value {
    font-size: 1.25rem;
  }

  .table {
    font-size: 0.9rem;
  }

  .stat-row,
  .chip-row {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 0.35rem;
    column-gap: 0.35rem;
    padding-bottom: 0;
  }

  .stat-row > *,
  .chip-row > * {
    flex: 1 1 calc(50% - 0.35rem) !important;
    min-width: 0 !important;
    max-width: 100%;
    text-align: center;
    white-space: normal;
  }

  .tasks-stats .task-stat-optional {
    display: none;
  }

  .form-grid > [class*="col-6"],
  .filter-grid > [class*="col-6"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .navbar .dropdown-menu {
    position: fixed !important;
    top: 64px !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    inset: auto !important;
    width: calc(100vw - 1rem);
    min-width: 0;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: var(--shadow);
    transform: none !important;
    margin: 0;
    padding: 0.25rem;
  }

  .navbar .dropdown-item {
    white-space: normal;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .receipt-layout {
    gap: 0.9rem;
  }

  .stepper {
    gap: 0.75rem;
  }

  .stepper-header {
    gap: 0.45rem;
    padding-bottom: 0.4rem;
  }

  .step-pill {
    padding: 0.28rem 0.62rem;
    font-size: 0.8rem;
  }

  .step-card {
    padding: 0.75rem;
    border-radius: 12px;
  }

  .step-card .form-label {
    margin-bottom: 0.25rem;
  }

  .form-section {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
  }

  .form-section summary {
    gap: 0.5rem;
  }

  .form-section summary .small {
    display: none;
  }

  .step-actions {
    margin-top: 0.75rem;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .step-actions .btn {
    --bs-btn-padding-y: 0.32rem;
    --bs-btn-padding-x: 0.68rem;
    --bs-btn-font-size: 0.92rem;
  }

  .expense-mobile-card .card-body {
    padding: 0.8rem;
  }

  .expense-mobile-card .expense-meta-secondary {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .expense-mobile-card .btn {
    --bs-btn-padding-x: 0.52rem;
  }

  .task-mobile-actions .btn,
  .expense-mobile-actions .btn,
  .shopping-mobile-actions .btn,
  .contracts-mobile-actions .btn,
  .timeline-mobile-actions .btn,
  .calendar-mobile-actions .btn,
  .projects-mobile-actions .btn,
  .timeline-show-mobile-actions .btn,
  .calendar-show-mobile-actions .btn,
  .task-show-mobile-actions .btn,
  .expense-show-mobile-actions .btn,
  .task-show-shopping-actions .btn,
  .expense-show-item-actions .btn,
  .project-show-mobile-actions .btn,
  .contract-show-mobile-actions .btn,
  .project-show-task-actions .btn,
  .contract-show-payment-actions .btn,
  .shopping-show-mobile-actions .btn,
  .timeline-form-mobile-actions .btn {
    min-height: 38px;
  }

  .tasks-stats {
    gap: 0.35rem;
  }

  .contracts-stats .contract-stat-optional {
    display: none;
  }

  .calendar-stats .calendar-stat-optional {
    display: none;
  }

  .timeline-kind-stats .timeline-kind-optional {
    display: none;
  }

  .timeline-show-pills .timeline-show-pill-optional,
  .calendar-show-pills .calendar-show-pill-optional,
  .task-show-pills .task-show-pill-optional,
  .expense-show-pills .expense-show-pill-optional,
  .shopping-show-pills .shopping-show-pill-optional,
  .project-show-header-stats .project-show-stat-optional,
  .contracts-show-link-stats .contracts-show-link-stat-optional {
    display: none;
  }

  .calendar-show-related:not([open]) > :not(summary) {
    display: none;
  }

}

@media (max-width: 991.98px) {
  /* Keep filter/stat chips fully visible on mobile + tablet widths. */
  .stat-row,
  .chip-row {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    row-gap: 0.35rem;
    column-gap: 0.35rem;
  }

  .stat-row > *,
  .chip-row > * {
    /* Prevent mid-word clipping by allowing natural width and line wrapping. */
    flex: 0 0 auto !important;
    min-width: auto !important;
    max-width: 100%;
  }
}

@media (min-width: 992px) {
  .receipt-layout {
    max-width: 980px;
  }
}

[data-theme="dark"] .dropdown-item {
  color: var(--text);
}

[data-theme="dark"] .dropdown-item:hover {
  background: color-mix(in srgb, var(--surface) 70%, #fff 30%);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .btn-outline-secondary,
[data-theme="dark"] .pill,
[data-theme="dark"] .chip {
  border-color: color-mix(in srgb, var(--border) 85%, #fff 15%);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: color-mix(in srgb, var(--surface) 90%, #000 10%);
  color: var(--text);
}

[data-theme="dark"] .btn-outline-secondary {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, #000 8%);
}

[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-secondary:focus {
  color: var(--text);
  background: var(--surface-3);
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text,
[data-theme="dark"] .text-body-secondary {
  color: var(--muted) !important;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .card-header.bg-white {
  background-color: var(--surface) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .card-header.bg-white {
  border-bottom-color: var(--border);
}

[data-theme="dark"] .modal-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: var(--border);
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(180%);
  opacity: 0.78;
}

[data-theme="dark"] .btn-close:hover,
[data-theme="dark"] .btn-close:focus {
  opacity: 1;
}

[data-theme="dark"] .text-bg-light,
[data-theme="dark"] .bg-light {
  background-color: var(--surface-3) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .timeline-thumb-btn {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="dark"] .timeline-thumb-btn:hover,
[data-theme="dark"] .timeline-thumb-btn:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--info) 30%, transparent 70%);
}

[data-theme="dark"] .thumb-remove {
  background: color-mix(in srgb, var(--surface-2) 86%, #000 14%);
}
