:root {
  --bg: #f2ede2;
  --bg-strong: #e8decb;
  --ink: #1a1f23;
  --ink-soft: #4f555b;
  --line: #c8bda7;
  --brand: #0f5f56;
  --brand-2: #f5a100;
  --brand-3: #b63f24;
  --card: rgba(255, 255, 255, 0.8);
  --ok: #207245;
  --error: #b22121;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(26, 31, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 20%, rgba(245, 161, 0, 0.22), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(15, 95, 86, 0.18), transparent 42%),
    linear-gradient(170deg, var(--bg) 0%, var(--bg-strong) 100%);
}

.noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 3px 3px;
}

.app-shell {
  width: min(1240px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
  position: relative;
  z-index: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  animation: panel-in 0.45s ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-panel {
  width: min(560px, 100%);
  margin: 5rem auto;
  position: relative;
  overflow: hidden;
}

.auth-deco {
  position: absolute;
  right: -80px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  opacity: 0.16;
}

h1,
h2,
h3 {
  margin: 0 0 0.6rem;
}

h1 {
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(1.55rem, 2.2vw, 2.1rem);
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1rem;
  margin-top: 1.2rem;
}

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

.auth-form,
.block-label {
  display: grid;
  gap: 0.8rem;
}

.auth-form {
  margin-top: 1rem;
}

label {
  font-size: 0.93rem;
  font-weight: 600;
}

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

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0.58rem 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn:hover {
  filter: brightness(0.97);
}

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

.btn-accent {
  background: linear-gradient(130deg, var(--brand-3), var(--brand-2));
  color: #fff;
}

.btn-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.status-banner {
  margin-bottom: 0.8rem;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  border: 1px solid;
  font-weight: 600;
}

.status-banner.info {
  background: rgba(15, 95, 86, 0.08);
  color: var(--brand);
  border-color: rgba(15, 95, 86, 0.35);
}

.status-banner.error {
  background: rgba(178, 33, 33, 0.12);
  color: var(--error);
  border-color: rgba(178, 33, 33, 0.35);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--line);
}

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

.user-tag {
  background: rgba(15, 95, 86, 0.1);
  border: 1px solid rgba(15, 95, 86, 0.3);
  color: var(--brand);
  border-radius: 999px;
  padding: 0.34rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-weight: 700;
}

.tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 1rem;
}

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

.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 8px 22px rgba(26, 31, 35, 0.08);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.inline-label {
  display: grid;
  gap: 0.3rem;
}

.radio-wrap {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  font-weight: 500;
}

.inline-tools {
  display: flex;
  gap: 0.5rem;
}

.drop-zone {
  display: grid;
  gap: 0.22rem;
  border: 2px dashed rgba(15, 95, 86, 0.4);
  border-radius: 14px;
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(160deg, rgba(15, 95, 86, 0.06), rgba(245, 161, 0, 0.08));
  margin-bottom: 0.9rem;
}

.drop-zone.dragover {
  border-color: var(--brand-3);
  background: linear-gradient(160deg, rgba(182, 63, 36, 0.12), rgba(245, 161, 0, 0.14));
}

.drop-zone input {
  display: none;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(248, 243, 233, 0.95);
  padding: 0.85rem;
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.entity-groups {
  display: grid;
  gap: 1rem;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}

.group-pill {
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 0.16rem 0.55rem;
  border: 1px solid;
}

.pill-primary {
  background: rgba(15, 95, 86, 0.12);
  color: var(--brand);
  border-color: rgba(15, 95, 86, 0.3);
}

.pill-extended {
  background: rgba(245, 161, 0, 0.14);
  color: #885600;
  border-color: rgba(245, 161, 0, 0.35);
}

.pill-custom {
  background: rgba(182, 63, 36, 0.14);
  color: #8f2f1b;
  border-color: rgba(182, 63, 36, 0.3);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.48rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.data-table td input[type="text"] {
  min-width: 170px;
}

.actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
}

.result-inline {
  margin-top: 1rem;
}

@media (max-width: 940px) {
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .inline-tools {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 1rem);
  }

  .card {
    padding: 0.85rem;
  }

  .radio-wrap {
    flex-direction: column;
  }
}
