:root {
  --bg: #050505;
  --panel: #0d0d0d;
  --panel-2: #0a0a0a;
  --muted: #94a3b8;
  --line: rgba(255,255,255,0.08);
  --line-soft: rgba(255,255,255,0.04);
  --green: #00e676;
  --green-2: #00ff84;
  --red: #dc2626;
  --amber: #f59e0b;
  --blue: #2563eb;
  --white: #ffffff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

img {
  display: block;
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(120px);
  opacity: 0.15;
}

.glow-1 {
  top: -10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: var(--green);
}

.glow-2 {
  bottom: -10%;
  left: -10%;
  width: 40%;
  height: 40%;
  background: #3b82f6;
  filter: blur(100px);
  opacity: 0.12;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
  background: rgba(0, 0, 0, 0.72);
  border-bottom: 1px solid var(--line-soft);
  padding: 18px 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 240px;
}

.brand-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-main {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-style: italic;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 1.6s infinite;
}

.brand-sub {
  font-size: 9px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

.brand-sep {
  width: 1px;
  height: 32px;
  background: var(--line);
}

.brand-meta {
  font-size: 12px;
  font-weight: 900;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1;
}

.search-wrap,
.field-wrap {
  position: relative;
  min-width: 250px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--white);
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
  transition: 0.2s ease;
  font-size: 13px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(0, 230, 118, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.12);
}

.search-input,
.input-with-icon,
.select-with-icon {
  padding-left: 42px;
}

.search-icon,
.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  opacity: 0.65;
  pointer-events: none;
}

.button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.button-primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

.button-primary:hover {
  background: var(--green-2);
  box-shadow: 0 0 24px rgba(0, 230, 118, 0.25);
}

.button-danger:hover {
  background: var(--red);
  border-color: var(--red);
}

.button-warning:hover {
  background: var(--amber);
  border-color: var(--amber);
  color: #000;
}

.button-blue:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.button.active-green {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

.button.active-blue {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.button.active-amber {
  background: var(--amber);
  color: #000;
  border-color: var(--amber);
}

.btn-icon {
  width: 15px;
  height: 15px;
  opacity: 0.9;
}

.btn-icon-dark {
  filter: brightness(0);
}

.config-panel {
  display: none;
  position: relative;
  z-index: 20;
  padding: 22px 24px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-soft);
}

.config-panel.open {
  display: block;
}

.config-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.config-row {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.label {
  display: block;
  margin: 0 0 8px 2px;
  font-size: 10px;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.config-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mini-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 20px;
  padding: 16px;
  cursor: pointer;
  transition: 0.2s ease;
}

.mini-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mini-card.active.active-green {
  background: rgba(0, 230, 118, 0.1);
  border-color: rgba(0, 230, 118, 0.3);
}

.mini-card.active.active-amber {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.28);
}

.mini-card.active.active-blue {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.28);
}

.mini-title {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.2em;
}

.mini-value {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.statusbar {
  display: none;
  position: relative;
  z-index: 15;
  padding: 10px 20px;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.statusbar.show {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.status-loading { background: #2563eb; color: #fff; }
.status-success { background: var(--green); color: #000; }
.status-warning { background: var(--amber); color: #000; }
.status-error { background: var(--red); color: #fff; }

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.filters-row {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filters-left,
.filters-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.empty {
  border: 2px dashed var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  color: #64748b;
  border-radius: 48px;
  padding: 90px 24px;
  text-align: center;
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  opacity: 0.18;
}

.empty-title {
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.26em;
}

.empty-sub {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.14em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 34px;
  padding: 28px;
  box-shadow: var(--shadow);
  transition: 0.25s ease;
  cursor: pointer;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
}

.card.active-card:hover {
  border-color: rgba(0, 230, 118, 0.35);
}

.card.deleted-card {
  background: #15110a;
  border-color: rgba(245, 158, 11, 0.12);
}

.card.deleted-card:hover {
  border-color: rgba(245, 158, 11, 0.28);
}

.card-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: 0.2s ease;
  z-index: 3;
}

.card:hover .card-actions {
  opacity: 1;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
  transition: 0.2s ease;
  display: grid;
  place-items: center;
}

.icon-btn img {
  width: 15px;
  height: 15px;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

.icon-btn.edit:hover {
  background: var(--green);
}

.icon-btn.edit:hover img,
.icon-btn.soft:hover img {
  filter: brightness(0);
}

.icon-btn.soft:hover {
  background: var(--amber);
}

.icon-btn.restore:hover {
  background: var(--blue);
}

.icon-btn.hard:hover {
  background: var(--red);
}

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-right: 120px;
}

.modal-badges {
  margin-bottom: 12px;
  padding-right: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: 900;
  padding: 7px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

.badge.green {
  background: rgba(0, 230, 118, 0.1);
  color: var(--green);
  border-color: rgba(0, 230, 118, 0.2);
}

.badge.amber {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.2);
}

.card-title {
  font-size: 25px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-style: italic;
  text-transform: uppercase;
  margin: 0 0 18px;
  padding-right: 18px;
}

.card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.modal-tags {
  margin-bottom: 22px;
}

.card-tag {
  font-size: 9px;
  font-weight: 900;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: #d1d5db;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.card-content {
  flex: 1;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.7;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  padding: 16px;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #cbd5e1;
  transition: 0.2s ease;
}

.card:hover .card-footer {
  background: rgba(255, 255, 255, 0.04);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(16px);
  background: rgba(0, 0, 0, 0.68);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 42px;
  box-shadow: var(--shadow);
}

.modal-md {
  max-width: 820px;
}

.modal-lg {
  max-width: 1120px;
}

.modal-header {
  padding: 28px 30px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.modal-sub {
  margin-top: 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.close-btn {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-body {
  padding: 28px 30px;
  overflow: auto;
}

.modal-footer {
  padding: 22px 30px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.checkbox-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.checkbox-row small {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

.checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.view-content {
  white-space: pre-wrap;
  color: #d1d5db;
  line-height: 1.95;
  font-size: 18px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  border-top: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #64748b;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 900;
}

.footer {
  position: relative;
  z-index: 20;
  margin-top: auto;
  backdrop-filter: blur(18px);
  background: rgba(0, 0, 0, 0.78);
  border-top: 1px solid var(--line-soft);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-top {
  font-size: 9px;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

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

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.dot.green {
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.dot.red {
  background: var(--red);
}

.stat {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #64748b;
}

.stat strong {
  color: #fff;
}

.import-summary {
  margin-bottom: 16px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-brand {
  text-align: right;
}

.footer-brand-top {
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--green);
  letter-spacing: 0.2em;
  font-style: italic;
}

.footer-brand-main {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 3px;
}

.footer-brand-main strong {
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.04em;
}

.footer-brand-main span {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

.footer-icon {
  width: 48px;
  height: 48px;
  border-radius: 20px;
  background: var(--green);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(0, 230, 118, 0.25);
}

.footer-icon img {
  width: 24px;
  height: 24px;
  filter: brightness(0);
}

.hidden {
  display: none !important;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.65; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

  .config-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .main,
  .footer,
  .config-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .brand-sep,
  .brand-meta {
    display: none;
  }

  .search-wrap,
  .field-wrap {
    width: 100%;
    min-width: 100%;
  }

  .toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar > * {
    flex: 1 1 auto;
  }

  .config-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-left,
  .filters-right {
    width: 100%;
  }

  .filters-right > * {
    flex: 1 1 auto;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .modal-title {
    font-size: 20px;
  }

  .card-actions {
    opacity: 1;
  }
}
