:root {
  --bg-1: #081423;
  --bg-2: #12324a;
  --bg-3: #234f44;
  --panel: rgba(12, 22, 36, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f3f7fb;
  --muted: #b8c6d4;
  --accent: #62b0ff;
  --accent-2: #7ee0b5;
  --danger: #ff7b72;
  --warning: #ffbc5c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(98, 176, 255, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(126, 224, 181, 0.18), transparent 35%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
}

.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.auth-shell,
.app-shell {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border-radius: 24px;
  display: grid;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--accent-2);
}

h1, h2, h3, p {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.auth-form,
.stack {
  display: grid;
  gap: 12px;
}

.auth-actions,
.modal-actions,
.header-actions,
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-switch {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch a {
  color: var(--accent-2);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  color: var(--text);
}

.btn.primary {
  background: linear-gradient(135deg, #1e87ff, #4ca6ff);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn.danger {
  background: rgba(255, 123, 114, 0.18);
  border: 1px solid rgba(255, 123, 114, 0.4);
}

.inline-message {
  min-height: 20px;
  font-size: 13px;
  color: var(--warning);
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 10px;
}

.app-header {
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.search-input {
  min-width: 220px;
}

.search-input,
.orphan-search-input,
.orphan-filter-select {
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-input::placeholder,
.orphan-search-input::placeholder {
  color: rgba(184, 198, 212, 0.72);
}

.search-input:focus,
.orphan-search-input:focus,
.orphan-filter-select:focus {
  outline: none;
  border-color: rgba(98, 176, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(98, 176, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.main-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 10px;
}

.orphan-column,
.content-panel,
.console {
  border-radius: 20px;
  padding: 12px;
  min-height: 0;
}

.content-panel {
  overflow: auto;
}

.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  align-items: start;
}

.store-box {
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-height: 96px;
}

.store-box.drag-over,
.orphan-column.drag-over {
  outline: 2px dashed var(--accent-2);
  background: rgba(126, 224, 181, 0.12);
}

.scartati-box {
  background: rgba(255, 188, 92, 0.1);
}

.store-header {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  transition: background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.store-header:hover {
  background: rgba(98, 176, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(98, 176, 255, 0.16);
}

.store-header:hover .store-title {
  color: #ffffff;
}

.store-header:hover .store-meta,
.store-header:hover .column-header {
  color: #cfe5ff;
}

.store-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.3;
}

.store-meta {
  min-height: 14px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.column-header {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.35;
}

.store-header .column-header {
  margin-bottom: 0;
}

.orphan-search-input {
  width: 100%;
  margin-bottom: 8px;
}

.orphan-filter-select {
  width: 100%;
  margin-bottom: 8px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(184, 198, 212, 0.8) 50%),
    linear-gradient(135deg, rgba(184, 198, 212, 0.8) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 1px),
    calc(100% - 13px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  color-scheme: dark;
}

.orphan-filter-select option {
  background: #102235;
  color: var(--text);
}

.cards-container {
  display: grid;
  gap: 8px;
}

.card {
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.card-title {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.25;
}

.terminal-title-badge {
  display: block;
  width: 100%;
  margin-bottom: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #eef7ff;
  background: linear-gradient(135deg, rgba(48, 121, 255, 0.56), rgba(41, 182, 246, 0.38));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.card-subtitle {
  margin-bottom: 7px;
  font-size: 12px;
  color: #e8eef6;
  font-weight: 600;
}

.badge,
.rt-badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(98, 176, 255, 0.2);
}

.card-grid {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.3;
}

.rt-grid {
  display: grid;
  gap: 8px;
}

.rt-box {
  border-radius: 14px;
  padding: 9px;
  background: rgba(7, 18, 30, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rt-box.drag-over {
  outline: 2px dashed var(--accent-2);
  background: rgba(126, 224, 181, 0.12);
}

.rt-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.rt-chip {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #eef7ff;
  background: linear-gradient(135deg, rgba(48, 121, 255, 0.82), rgba(41, 182, 246, 0.66));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.rt-count {
  font-size: 10px;
  color: var(--muted);
}

.rt-box-empty {
  padding: 10px 8px;
  border-radius: 10px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
}

.rt-box .card {
  padding: 9px;
  background: rgba(255, 255, 255, 0.06);
}

.rt-box .terminal-title-badge {
  margin-bottom: 6px;
  padding: 4px 8px;
  font-size: 10px;
}

.rt-box .card-title {
  font-size: 12px;
}

.rt-box .card-grid {
  font-size: 11px;
}

.mono {
  font-family: Consolas, monospace;
}

.console {
  display: flex;
  flex-direction: column;
}

.console.collapsed {
  display: none;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.console-logs {
  overflow: auto;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.log-entry {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.log-entry.error {
  border-left: 3px solid var(--danger);
}

.log-entry.success {
  border-left: 3px solid var(--accent-2);
}

.log-entry.warning {
  border-left: 3px solid var(--warning);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 18, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  width: min(640px, 100%);
  border-radius: 24px;
  padding: 24px;
}

.modal.compact {
  width: min(420px, 100%);
}

.modal.large {
  width: min(820px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.form-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-section-header {
  display: grid;
  gap: 4px;
}

.form-section-title {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-section-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-row input {
  width: auto;
}

.dialog-copy,
.guide-copy {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}