@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #08090a;
  --surface: #0d0e10;
  --surface-soft: #0a0b0d;
  --surface-hover: #131419;
  --surface-elevated: #15161a;

  --text: #f4f4f5;
  --text-secondary: #92939b;
  --text-tertiary: #5f616b;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.13);

  --accent: #8b82f6;
  --accent-hover: #9a92ff;
  --accent-soft: rgba(139, 130, 246, 0.10);
  --accent-border: rgba(139, 130, 246, 0.20);
  --accent-glow: rgba(139, 130, 246, 0.08);

  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.08);
  --success-border: rgba(74, 222, 128, 0.15);

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.08);
  --danger-border: rgba(248, 113, 113, 0.15);

  --warning: #f0b860;
  --warning-soft: rgba(240, 184, 96, 0.08);
  --warning-border: rgba(240, 184, 96, 0.15);

  --closed: #9698a2;
  --closed-soft: rgba(150, 152, 162, 0.08);
  --closed-border: rgba(150, 152, 162, 0.14);

  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm:
    0 1px 2px rgba(0, 0, 0, 0.25);

  --shadow-md:
    0 8px 30px rgba(0, 0, 0, 0.28);

  --shadow-accent:
    0 0 0 3px rgba(139, 130, 246, 0.08);

  --font:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --mono:
    "JetBrains Mono",
    monospace;
}


/* ============================================================
   RESET
============================================================ */

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;

  background:
    radial-gradient(
      circle at 70% -20%,
      rgba(139, 130, 246, 0.07),
      transparent 30%
    ),
    radial-gradient(
      circle at 10% 100%,
      rgba(139, 130, 246, 0.025),
      transparent 25%
    ),
    var(--bg);

  color: var(--text);

  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}


/* ============================================================
   TOPBAR
============================================================ */

.topbar {
  height: 70px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 30px;

  background: rgba(8, 9, 10, 0.82);

  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-mark {
  width: 32px;
  height: 32px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 9px;

  background:
    linear-gradient(
      145deg,
      #1c1d22,
      #101114
    );

  color: #ffffff;

  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.25);
}

.topbar h1 {
  font-size: 14px;
  font-weight: 600;

  letter-spacing: -0.015em;
}

.topbar-sub {
  margin-top: 1px;

  color: var(--text-secondary);

  font-size: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tally {
  color: var(--text-secondary);

  font-family: var(--mono);
  font-size: 10px;

  white-space: pre;
}


/* ============================================================
   INSTALL
============================================================ */

.btn-install {
  padding: 7px 11px;

  border: 1px solid var(--accent-border);
  border-radius: 7px;

  background: var(--accent-soft);
  color: var(--accent);

  font-size: 11px;
  font-weight: 600;

  cursor: pointer;

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.btn-install:hover {
  background: rgba(139, 130, 246, 0.14);

  border-color: rgba(139, 130, 246, 0.30);

  box-shadow:
    0 0 20px var(--accent-glow);
}

.btn-install:active {
  transform: translateY(1px);
}


/* ============================================================
   LAYOUT
============================================================ */

.layout {
  display: grid;

  grid-template-columns: 310px minmax(0, 1fr);

  min-height: calc(100vh - 70px);
}

.panel {
  padding: 30px;
}

.form-panel {
  background:
    linear-gradient(
      180deg,
      rgba(13, 14, 16, 0.98),
      rgba(10, 11, 13, 0.98)
    );

  border-right: 1px solid var(--border);
}

.list-panel {
  width: 100%;
  max-width: 1100px;
}


/* ============================================================
   HEADINGS
============================================================ */

.panel-heading,
.list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 20px;
}

.panel-heading {
  margin-bottom: 24px;
}

.list-head {
  margin-bottom: 20px;
}

.panel h2,
.list-head h2 {
  font-size: 17px;
  line-height: 1.2;

  font-weight: 600;

  letter-spacing: -0.025em;

  color: var(--text);
}

.eyebrow {
  display: block;

  margin-bottom: 6px;

  color: var(--text-tertiary);

  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;

  letter-spacing: 0.10em;
}


/* ============================================================
   FORM
============================================================ */

#form-contatto label {
  display: block;

  margin: 18px 0 7px;

  color: var(--text-secondary);

  font-size: 12px;
  font-weight: 500;
}

#form-contatto label:first-of-type {
  margin-top: 0;
}

#form-contatto input,
#form-contatto select,
#form-contatto textarea {
  width: 100%;

  padding: 9px 10px;

  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);

  outline: none;

  background: #0f1012;
  color: var(--text);

  font-size: 13px;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.015),
    var(--shadow-sm);

  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

#form-contatto input {
  height: 38px;
}

#form-contatto input::placeholder,
#form-contatto textarea::placeholder {
  color: var(--text-tertiary);
}

#form-contatto input:hover,
#form-contatto select:hover,
#form-contatto textarea:hover {
  border-color: rgba(255, 255, 255, 0.18);

  background: #111216;
}

#form-contatto input:focus,
#form-contatto select:focus,
#form-contatto textarea:focus {
  border-color: var(--accent);

  background: #101116;

  box-shadow:
    var(--shadow-accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

#form-contatto textarea {
  min-height: 82px;

  resize: vertical;

  line-height: 1.5;
}

#form-contatto select {
  height: 38px;
}


/* ============================================================
   BUTTON
============================================================ */

.btn-add {
  width: 100%;
  min-height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 8px;

  margin-top: 22px;
  padding: 9px 14px;

  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);

  background:
    linear-gradient(
      180deg,
      #1d1e23,
      #15161a
    );

  color: #f5f5f5;

  font-size: 13px;
  font-weight: 600;

  cursor: pointer;

  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.btn-add:hover {
  border-color: rgba(139, 130, 246, 0.35);

  background:
    linear-gradient(
      180deg,
      #272630,
      #1d1d24
    );

  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.28),
    0 0 20px rgba(139, 130, 246, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-add:active {
  transform: translateY(1px);
}

.btn-arrow {
  color: var(--accent);

  opacity: 0.8;

  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.btn-add:hover .btn-arrow {
  opacity: 1;

  transform: translate(2px, -2px);
}


/* ============================================================
   FILTERS
============================================================ */

.filters {
  display: flex;
  flex-wrap: wrap;

  gap: 4px;
}

.filtro {
  padding: 5px 9px;

  border: 1px solid transparent;
  border-radius: 7px;

  background: transparent;
  color: var(--text-secondary);

  font-size: 11px;
  font-weight: 500;

  cursor: pointer;

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.filtro:hover {
  background: var(--surface-hover);

  color: var(--text);
}

.filtro.is-active {
  background: var(--accent-soft);

  border-color: var(--accent-border);

  color: var(--accent);

  box-shadow:
    0 0 18px rgba(139, 130, 246, 0.035);
}


/* ============================================================
   LIST
============================================================ */

.list-container {
  width: 100%;
}

.lista {
  list-style: none;

  margin: 0;
  padding: 0;

  display: grid;
  gap: 8px;
}

.riga-contatto {
  position: relative;

  padding: 15px 16px 14px;

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  background:
    linear-gradient(
      180deg,
      rgba(16, 17, 20, 0.98),
      rgba(13, 14, 16, 0.98)
    );

  display: grid;
  gap: 9px;

  box-shadow: var(--shadow-sm);

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease;
}

.riga-contatto:hover {
  border-color: rgba(255, 255, 255, 0.13);

  background:
    linear-gradient(
      180deg,
      #111216,
      #0f1012
    );

  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(139, 130, 246, 0.015);

  transform: translateY(-1px);
}


/* ============================================================
   STATUS INDICATOR
============================================================ */

.riga-contatto::before {
  content: "";

  position: absolute;

  top: 13px;
  bottom: 13px;
  left: 0;

  width: 3px;

  border-radius: 0 4px 4px 0;

  background: var(--border-strong);
}

.riga-contatto[data-stato="attesa"]::before {
  background: var(--warning);
  box-shadow: 0 0 10px rgba(240, 184, 96, 0.12);
}

.riga-contatto[data-stato="si"]::before {
  background: var(--success);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.12);
}

.riga-contatto[data-stato="no"]::before {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.10);
}

.riga-contatto[data-stato="chiuso"]::before {
  background: var(--closed);
}


/* ============================================================
   CONTENT
============================================================ */

.riga-top {
  display: flex;

  justify-content: space-between;
  align-items: flex-start;

  gap: 16px;
}

.riga-nome {
  color: var(--text);

  font-size: 13px;
  font-weight: 600;

  letter-spacing: -0.01em;
}

.riga-meta {
  margin-top: 3px;

  color: var(--text-tertiary);

  font-family: var(--mono);
  font-size: 9px;
}

.riga-gancio {
  max-width: 760px;

  color: var(--text-secondary);

  font-size: 12px;
  line-height: 1.5;
}


/* ============================================================
   BADGES
============================================================ */

.badge {
  padding: 3px 8px;

  border: 1px solid transparent;
  border-radius: 999px;

  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;

  white-space: nowrap;
}

.badge[data-stato="attesa"] {
  background: var(--warning-soft);
  color: var(--warning);

  border-color: var(--warning-border);
}

.badge[data-stato="si"] {
  background: var(--success-soft);
  color: var(--success);

  border-color: var(--success-border);
}

.badge[data-stato="no"] {
  background: var(--danger-soft);
  color: var(--danger);

  border-color: var(--danger-border);
}

.badge[data-stato="chiuso"] {
  background: var(--closed-soft);
  color: var(--closed);

  border-color: var(--closed-border);
}


/* ============================================================
   ACTIONS
============================================================ */

.riga-azioni {
  display: flex;
  align-items: center;

  gap: 6px;

  margin-top: 1px;
}

.riga-azioni select {
  padding: 5px 7px;

  border: 1px solid var(--border);
  border-radius: 6px;

  outline: none;

  background: #101114;
  color: var(--text-secondary);

  font-family: var(--mono);
  font-size: 10px;

  cursor: pointer;

  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.riga-azioni select:hover {
  border-color: var(--border-strong);

  background: #14151a;

  color: var(--text);
}

.riga-azioni select:focus {
  border-color: var(--accent);

  box-shadow: var(--shadow-accent);
}

.btn-elimina {
  padding: 5px 7px;

  border: none;
  border-radius: 6px;

  background: transparent;
  color: var(--text-tertiary);

  font-family: var(--mono);
  font-size: 10px;

  cursor: pointer;

  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.btn-elimina:hover {
  background: var(--danger-soft);
  color: var(--danger);
}


/* ============================================================
   EMPTY
============================================================ */

.vuoto {
  padding: 70px 20px;

  text-align: center;

  color: var(--text-tertiary);

  font-family: var(--mono);
  font-size: 11px;
}


/* ============================================================
   SCROLLBAR
============================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #292a30;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3b43;
}


/* ============================================================
   SELECTION
============================================================ */

::selection {
  background: rgba(139, 130, 246, 0.25);
  color: #ffffff;
}


/* ============================================================
   RESPONSIVE
============================================================ */

@media (max-width: 900px) {

  .layout {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .panel {
    padding: 24px;
  }

  .topbar {
    padding: 0 24px;
  }
}


@media (max-width: 760px) {

  .topbar {
    height: auto;
    min-height: 72px;

    padding: 15px 20px;

    gap: 12px;
  }

  .topbar-right {
    width: 100%;

    justify-content: space-between;
  }

  .tally {
    flex: 1;
  }

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

  .form-panel {
    border-right: none;

    border-bottom: 1px solid var(--border);
  }

  .list-panel {
    max-width: none;
  }
}


@media (max-width: 520px) {

  .panel {
    padding: 20px 16px;
  }

  .list-head {
    align-items: flex-start;

    flex-direction: column;
  }

  .filters {
    width: 100%;
  }

  .riga-top {
    flex-direction: column;

    gap: 8px;
  }

  .badge {
    align-self: flex-start;
  }

  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}