:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --border: #e2e8f0;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --max-w: 1160px;
}

[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-surface: #1e293b;
  --bg-subtle: #0f172a;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.16);
  --border: #334155;
  --success: #4ade80;
  --success-bg: rgba(21, 128, 61, 0.25);
  --warning: #fbbf24;
  --warning-bg: rgba(180, 83, 9, 0.25);
  --danger: #f87171;
  --danger-bg: rgba(185, 28, 28, 0.25);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Noto Sans Georgian", "FiraGO", "Sylfaen", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s, color 0.2s;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: var(--bg-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 0.75rem;
  padding: 0.45rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
  text-decoration: none !important;
  flex-shrink: 0;
}



.header-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.68rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.36rem 0.54rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.7rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-main);
}

main {
  flex: 1;
  padding: 2rem 0 3.5rem;
}

.hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: 1.8rem;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.hero p {
  color: var(--text-muted);
  max-width: 100%;
  margin-bottom: 1.25rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.search-input-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.input,
textarea,
select {
  width: 100%;
  padding: 0.68rem 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

textarea {
  min-height: 175px;
  resize: vertical;
}

.font-sylfaen {
  font-family: "Sylfaen", "BPG Glaho", Georgia, serif !important;
  font-size: 1.04rem;
}

.category-pills,
.tabs-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tabs-bar {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
}

.pill-btn,
.tab-btn {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover,
.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pill-btn.active,
.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-decoration: none !important;
  color: inherit;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.fav-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: all 0.15s;
}

.fav-btn:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}

.fav-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #f59e0b;
}

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tool-card h2,
.tool-card h3 {
  font-size: 1.12rem;
  margin-bottom: 0.45rem;
  color: var(--text-main);
}

.tool-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.card-action {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.page-header h1 {
  font-size: 1.7rem;
  margin-bottom: 0.45rem;
  line-height: 1.3;
}

.page-header p {
  color: var(--text-muted);
  max-width: 100%;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.panel-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.91rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none !important;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.83rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.stat-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.2rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.result-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}

.result-card-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: block;
}

.result-card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin-bottom: 1.1rem;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.3);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.3);
}

.alert-info {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.25);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.3);
}

.hidden {
  display: none !important;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 440px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 0.58rem 0.78rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--bg-subtle);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.alt-group {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.file-list {
  list-style: none;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.file-list-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.preview-box {
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-box img,
.preview-box canvas {
  max-width: 100%;
  max-height: 320px;
  border-radius: 6px;
  object-fit: contain;
}

.back-to-top {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 990;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}

.back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
}

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .site-header,
  .site-footer,
  .btn-row,
  .back-to-top,
  .toast-container,
  .breadcrumb,
  .tabs-bar {
    display: none !important;
  }
  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .panel {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 1rem !important;
    padding: 1rem !important;
  }
  .table-wrap {
    max-height: none !important;
    overflow: visible !important;
    border: 1px solid #cbd5e1 !important;
  }
  th {
    position: static !important;
    background: #f1f5f9 !important;
    color: #000 !important;
  }
}

.brand-logo {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.brand-logo:hover { transform: scale(1.03); }
.brand-logo img {
  height: 46px;
  width: auto;
  object-fit: contain;
  display: block;
}
[data-theme="dark"] .brand-logo {
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: 10px;
}

@media (max-width: 860px) {
  .container {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
  .site-header .container {
    padding-left: 1.35rem !important;
    padding-right: 1.5rem !important;
  }
  .header-inner {
    min-height: 68px;
    padding: 0.7rem 0 !important;
    flex-wrap: wrap;
  }
  .brand-logo { height: 40px; }
  .brand-logo img { height: 36px; }
  .header-controls { gap: 0.55rem; margin-right: 0.15rem; }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.42rem 0.85rem;
    font-weight: 600;
    background: var(--bg-subtle);
  }
  .theme-toggle-btn { min-height: 40px; padding: 0.42rem 0.75rem; }
  .main-nav {
    display: none;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    padding: 0.75rem 0 0.4rem;
    margin-top: 0.45rem;
    border-top: 1px solid var(--border);
  }
  .main-nav.open { display: grid; }
  .nav-link {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 0.55rem 0.65rem;
    font-size: 0.84rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  main { padding: 1.4rem 0 2.75rem; }
  .hero { padding: 1.35rem 1.25rem; margin-bottom: 1.35rem; }
  .hero h1 { font-size: 1.38rem; margin-bottom: 0.55rem; }
  .hero p { font-size: 0.92rem; margin-bottom: 1rem; }
  .filter-bar { gap: 0.65rem; margin-top: 0.6rem; }
  .category-pills, .tabs-bar {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .category-pills::-webkit-scrollbar, .tabs-bar::-webkit-scrollbar { display: none; }
  .pill-btn, .tab-btn { flex-shrink: 0; padding: 0.48rem 0.9rem; font-size: 0.85rem; }
  .section-header { padding: 0 0.1rem; margin-bottom: 0.9rem; }
  .cards-grid { grid-template-columns: 1fr; gap: 0.95rem; margin-bottom: 1.6rem; }
  .tool-card { padding: 1.25rem; }
  .page-header {
    padding: 0.2rem 0.1rem;
    margin-bottom: 1.25rem;
  }
  .page-header h1 { font-size: 1.38rem; margin-bottom: 0.5rem; }
  .page-header p { font-size: 0.92rem; }
  .panel { padding: 1.25rem; margin-bottom: 1.15rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 0.9rem; }
  .input, textarea, select { font-size: 16px; min-height: 44px; padding: 0.62rem 0.85rem; }
  textarea { min-height: 140px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
  .stat-box { padding: 0.75rem 0.85rem; }
  .stat-value { font-size: 1.05rem; }
  .btn-row { gap: 0.5rem; }
  .btn-row .btn { flex: 1 1 auto; min-height: 44px; font-size: 0.88rem; }
  th, td { padding: 0.5rem 0.6rem; font-size: 0.83rem; }
  .footer-inner { padding: 0 0.1rem; }
  .back-to-top { bottom: 1rem; left: 1rem; width: 40px; height: 40px; }
}
