﻿:root {
  --ksef-bg: #f6f7fb;
  --ksef-card: #ffffff;
  --ksef-muted: #6b7280;
  --ksef-text: #111827;
  --ksef-primary: #2563eb;
  --ksef-indigo: #6366f1;
  --ksef-purple: #8b5cf6;
  --ksef-success: #22c55e;
  --ksef-warning: #f59e0b;
  --ksef-danger: #ef4444;
  --ksef-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  --ksef-radius: 18px;
}

* {
  box-sizing: border-box;
}

body.ksef-body {
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--ksef-text);
  background: radial-gradient(circle at top left, #f0f6ff 0%, #f7f8fb 45%, #fcfbff 100%);
  min-height: 100vh;
  position: relative;
}

body.ksef-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(15, 23, 42, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: -1;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #eef0f6;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  border-radius: 10px;
  padding: 4px 8px;
}

.sidebar-toggle i {
  transition: transform 0.2s ease;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb 0%, #8b5cf6 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.brand-text h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

.brand-text span {
  font-size: 12px;
  color: var(--ksef-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: #4b5563;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-link i {
  font-size: 18px;
}

.sidebar-link:hover {
  background: #f2f5ff;
  color: #1f2937;
}

.sidebar-link.active {
  background: #e9efff;
  color: #1f3b8b;
  font-weight: 600;
  position: relative;
}

.sidebar-link.active::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

.sidebar-collapsed .sidebar {
  width: 84px;
  padding: 24px 10px;
}

.sidebar-collapsed .brand-text {
  display: none;
}

.sidebar-collapsed .sidebar-link {
  justify-content: center;
  gap: 0;
  font-size: 0;
}

.sidebar-collapsed .sidebar-link i {
  font-size: 18px;
}

.sidebar-collapsed .sidebar-link.active::after {
  right: 8px;
}

.sidebar-collapsed .profile-card {
  justify-content: center;
}

.sidebar-collapsed .profile-info,
.sidebar-collapsed .profile-card i {
  display: none;
}

.sidebar-collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

.offcanvas .sidebar-toggle {
  display: none;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f7f8fb;
  padding: 12px;
  border-radius: 14px;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.profile-info small {
  display: block;
  color: var(--ksef-muted);
}

.main-content {
  flex: 1;
  padding: 32px 40px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--ksef-shadow);
  margin-bottom: 20px;
}

.topbar-title {
  flex: 1;
  text-align: center;
  font-weight: 700;
  margin: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.xsd-builder {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.xsd-node {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xsd-node[data-xsd-depth="1"] {
  border-color: #e2e8f0;
  background: #ffffff;
  box-shadow: none;
}

.xsd-node[data-xsd-depth="1"] > .xsd-header .xsd-title {
  font-size: 16px;
}

.xsd-node[data-xsd-depth="1"] > .xsd-header {
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.xsd-node[data-xsd-depth="0"] > .xsd-header {
  display: none;
}

.xsd-node[data-xsd-depth="1"] .xsd-children,
.xsd-node[data-xsd-depth="2"] .xsd-children {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

.xsd-node[data-xsd-depth="2"] {
  background: #ffffff;
}

.xsd-hidden {
  display: none !important;
}

.xsd-basic .xsd-meta {
  display: none;
}

.xsd-basic .xsd-doc {
  color: #64748b;
}

.xsd-basic .xsd-node[data-xsd-optional="true"] {
  display: none;
}

.xsd-basic .xsd-toggle {
  display: none;
}

.invoice-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-section h6 {
  margin: 0;
  font-weight: 600;
}

.invoice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

.invoice-summary {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  justify-items: end;
}

.invoice-summary strong {
  display: block;
  font-size: 16px;
}

.invoice-summary span {
  font-size: 12px;
  color: #6b7280;
}

.xsd-advanced .xsd-node[data-xsd-optional="true"] {
  display: flex;
}

.xsd-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.xsd-toggle {
  border-radius: 10px;
}

.xsd-toggle i {
  transition: transform 0.2s ease;
}

.xsd-collapsed > .xsd-instances {
  display: none;
}

.xsd-collapsed .xsd-toggle i {
  transform: rotate(-90deg);
}

.xsd-title {
  font-weight: 600;
}

.xsd-meta {
  font-size: 12px;
  color: #94a3b8;
}

.xsd-doc {
  font-size: 12px;
  color: var(--ksef-muted);
}

.xsd-children {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.xsd-instances {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xsd-instance {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xsd-remove {
  position: absolute;
  top: 10px;
  right: 10px;
}

.xsd-choice {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xsd-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xsd-input .form-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 2px;
}

.xsd-input .form-control,
.xsd-input .form-select {
  border-radius: 6px;
  border: 1px solid #d9dee7;
  padding: 6px 10px;
  font-size: 13px;
  height: 34px;
}

.xsd-input .form-control:focus,
.xsd-input .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.xsd-input .form-control::placeholder {
  color: #9ca3af;
}

.xsd-preview {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 12px;
  font-size: 12px;
  min-height: 240px;
  white-space: pre-wrap;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--ksef-muted);
}

.k-card {
  background: var(--ksef-card);
  border: 1px solid #eef0f6;
  border-radius: var(--ksef-radius);
  box-shadow: var(--ksef-shadow);
}

.stat-card {
  border: none;
  border-radius: 18px;
  padding: 18px;
  color: #0f172a;
  box-shadow: var(--ksef-shadow);
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.stat-card h3 {
  margin: 16px 0 4px;
  font-weight: 700;
}

.stat-card small {
  color: #475569;
}

.stat-blue {
  background: linear-gradient(135deg, #e0ecff 0%, #f2f7ff 100%);
}

.stat-peach {
  background: linear-gradient(135deg, #ffe7d1 0%, #fff4ea 100%);
}

.stat-lilac {
  background: linear-gradient(135deg, #ede3ff 0%, #f7f2ff 100%);
}

.stat-mint {
  background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 100%);
}

.rule-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  gap: 16px;
}

.rule-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rule-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #f3e8ff;
  color: #7c3aed;
  font-size: 20px;
}

.rule-content h5 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.rule-content .meta {
  color: var(--ksef-muted);
  font-size: 13px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.status-pill {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
}

.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.table td {
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background: #f8fafc;
}

.badge-soft {
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12px;
}

.badge-soft.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-soft.gray {
  background: #f3f4f6;
  color: #374151;
}

.badge-soft.green {
  background: #dcfce7;
  color: #15803d;
}

.badge-soft.purple {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-soft.orange {
  background: #ffedd5;
  color: #c2410c;
}

.form-control,
.form-select {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 10px 14px;
}

.btn-primary {
  background: #6d28d9;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  box-shadow: 0 10px 20px rgba(109, 40, 217, 0.2);
}

.btn-outline-secondary {
  border-radius: 12px;
}

.quick-action {
  border-radius: 16px;
  color: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.quick-action:hover {
  transform: translateY(-2px);
  color: #fff;
}

.quick-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.quick-purple {
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
}

.quick-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.quick-dark {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.alert-card {
  border-radius: 16px;
  background: #fef9e8;
  border: 1px solid #fde68a;
  padding: 16px;
  font-size: 14px;
}

.chart-placeholder {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 14px;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--ksef-card);
  border: 1px solid #eef0f6;
  border-radius: 22px;
  box-shadow: var(--ksef-shadow);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}

.auth-brand small {
  color: var(--ksef-muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  font-size: 12px;
  margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e5e7eb;
}

.auth-meta {
  color: var(--ksef-muted);
  font-size: 14px;
}

.error-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.error-card {
  text-align: center;
  max-width: 520px;
  background: var(--ksef-card);
  border: 1px solid #eef0f6;
  border-radius: 24px;
  box-shadow: var(--ksef-shadow);
  padding: 36px 28px;
}

.error-card h1 {
  font-size: 64px;
  margin: 0;
  color: #1d4ed8;
}

.error-card p {
  color: var(--ksef-muted);
}

@media (max-width: 991px) {
  .main-content {
    padding: 24px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
}

@media (max-width: 575px) {
  .main-content {
    padding: 18px;
  }

  .stat-card {
    padding: 16px;
  }
}

.subject-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subject-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.subject-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.subject-meta {
  color: var(--ksef-muted);
  font-size: 13px;
}

.subject-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.subject-section {
  background: #f8fafc;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tag-soft {
  background: #eef2ff;
  color: #4338ca;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.recipient-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #eef0f6;
  border-radius: 12px;
  padding: 10px 12px;
}

.recipient-row small {
  display: block;
  color: var(--ksef-muted);
}

.recipient-form {
  background: #ffffff;
  border: 1px solid #eef0f6;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-section {
  border: 1px dashed #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.pricing-card {
  background: #ffffff;
  color: var(--ksef-text);
  border-radius: 18px;
  padding: 22px;
  border: 1px solid #eef0f6;
  box-shadow: var(--ksef-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pricing-card.featured {
  background: linear-gradient(135deg, #f3e8ff 0%, #ffffff 100%);
  border-color: #c4b5fd;
  box-shadow: 0 18px 32px rgba(124, 58, 237, 0.18);
}

.pricing-title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: #94a3b8;
}

.pricing-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--ksef-text);
}

.pricing-price span {
  font-size: 12px;
  color: var(--ksef-muted);
  font-weight: 500;
}

.pricing-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.pricing-features li::before {
  content: "•";
  color: #7c3aed;
  margin-right: 8px;
}

.pricing-cta .btn {
  border-radius: 12px;
  font-weight: 600;
}

.pricing-card .badge-soft {
  background: #ede9fe;
  color: #6d28d9;
}

.trial-card {
  border: 1px solid #dbeafe;
  background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 100%);
  position: relative;
  overflow: hidden;
}

.trial-card::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0) 70%);
  pointer-events: none;
}

.trial-badge {
  background: #e0ecff;
  color: #1d4ed8;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}

.trial-note {
  background: #eef2ff;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #4b5563;
}
