:root {
  --ink: #172019;
  --muted: #6d776f;
  --line: #dfe6df;
  --surface: #ffffff;
  --canvas: #f2f5f1;
  --green: #1d7a4a;
  --green-dark: #145c37;
  --green-soft: #e7f5ec;
  --lime: #b9ec75;
  --shadow: 0 20px 55px rgba(34, 52, 39, 0.08);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(185, 236, 117, 0.13), transparent 25rem),
    linear-gradient(180deg, #f8faf7 0, var(--canvas) 36rem);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
a { color: inherit; }

.topbar {
  height: 78px;
  padding: 0 max(24px, calc((100vw - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 32, 25, 0.08);
  background: rgba(248, 250, 247, 0.84);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 32, 25, 0.16);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #42b978;
  box-shadow: 0 0 0 5px rgba(66, 185, 120, 0.12);
}

.account a {
  margin-left: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-weight: 700;
  text-decoration: none;
}

.account a:hover { color: var(--ink); }

.shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 62px 0 80px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 36px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.view-switch {
  padding: 5px;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.65);
}

.view-switch a {
  min-height: 43px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.view-switch a.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 6px 18px rgba(28, 46, 33, 0.1);
}

.view-switch strong {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
}

.add-card {
  padding: 30px;
  border: 1px solid rgba(23, 32, 25, 0.09);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.add-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.add-heading .plus {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 27px;
  font-weight: 500;
}

.add-heading .eyebrow { margin-bottom: 3px; }
.add-heading h2, .list-heading h2 { margin: 0; font-size: 23px; letter-spacing: -0.035em; }

.form-error {
  margin: -6px 0 20px;
  padding: 13px 15px;
  border: 1px solid #f1b7af;
  border-radius: 12px;
  color: #8c2f22;
  background: #fff0ee;
  font-size: 13px;
  font-weight: 650;
}

.client-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.client-form label {
  display: grid;
  gap: 8px;
  color: #4c574f;
  font-size: 12px;
  font-weight: 750;
}

.client-form input,
.client-form textarea {
  width: 100%;
  border: 1px solid #d9e0d9;
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: #fbfcfa;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.client-form input { height: 48px; padding: 0 15px; }
.client-form textarea { min-height: 88px; padding: 14px 15px; resize: vertical; line-height: 1.5; }
.client-form input::placeholder, .client-form textarea::placeholder { color: #a0a9a2; }

.client-form input:focus,
.client-form textarea:focus {
  border-color: #6ab78a;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(76, 169, 112, 0.12);
}

.url-field, .reason-field { grid-column: 1 / -1; }

.primary-button,
.secondary-button,
.complete-button,
.reopen-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  min-height: 50px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(23, 32, 25, 0.16);
  transition: transform 140ms ease, background 140ms ease;
}

.client-form .primary-button { grid-column: 1 / -1; justify-self: end; min-width: 210px; }
.primary-button:hover { background: #263329; transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }

.list-section { margin-top: 48px; }
.list-heading { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; }
.list-heading .eyebrow { margin-bottom: 4px; }

.live-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.live-summary i,
.active-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36b672;
  box-shadow: 0 0 0 0 rgba(54, 182, 114, 0.5);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 182, 114, 0.45); }
  60%, 100% { box-shadow: 0 0 0 8px rgba(54, 182, 114, 0); }
}

.client-list { display: grid; gap: 13px; }

.client-card {
  min-height: 174px;
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 25, 0.09);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 35px rgba(35, 51, 40, 0.055);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.client-card:hover { transform: translateY(-2px); box-shadow: 0 18px 45px rgba(35, 51, 40, 0.09); }
.client-status { background: linear-gradient(180deg, #66ce8f, #1e864f); }
.client-card.completed .client-status { background: #cbd2cc; }

.client-main { min-width: 0; padding: 24px 26px; }
.client-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.client-number { margin: 0 0 3px; color: #9ba49d; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; }
.client-title-row h3 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -0.035em; }

.active-badge,
.archive-badge {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.archive-badge { color: #6d756f; background: #eef1ee; }

.reason { margin: 13px 0 18px; color: #4d5850; line-height: 1.55; white-space: pre-wrap; }
.client-card.completed .reason { color: #747c76; }
.client-links { display: flex; flex-wrap: wrap; gap: 9px; }

.phone-link,
.backoffice-link {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  transition: background 140ms ease, transform 140ms ease;
}

.phone-link { color: var(--green-dark); background: var(--green-soft); }
.backoffice-link { color: #465248; background: #f0f3f0; }
.phone-link:hover, .backoffice-link:hover { transform: translateY(-1px); filter: brightness(0.98); }

.client-action {
  min-width: 170px;
  padding: 24px;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--line);
  background: rgba(248, 250, 247, 0.78);
}

.complete-button,
.reopen-button {
  width: 100%;
  min-height: 46px;
  padding: 0 17px;
  border-radius: 13px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 9px 20px rgba(29, 122, 74, 0.18);
  transition: transform 140ms ease, background 140ms ease;
}

.complete-button span { margin-right: 4px; }
.complete-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.reopen-button { color: #455047; background: #e8ede9; box-shadow: none; }
.reopen-button:hover { background: #dce4dd; }

.empty-state {
  min-height: 260px;
  padding: 44px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  border: 1px dashed #cfd8d0;
  border-radius: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
}

.empty-state > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 23px;
}

.empty-state h3 { margin: 18px 0 7px; color: var(--ink); font-size: 20px; }
.empty-state p { margin: 0; font-size: 14px; }

footer {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 25px 0 35px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: #8a938c;
  font-size: 11px;
}

footer span:first-child { color: #59635b; font-weight: 800; }

.confirm-dialog {
  width: min(440px, calc(100% - 30px));
  padding: 31px;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(16, 26, 19, 0.28);
}

.confirm-dialog::backdrop { background: rgba(17, 26, 20, 0.48); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer; color: #5e6861; background: #eff2ef; font-size: 22px; }
.dialog-icon { width: 48px; height: 48px; margin-bottom: 21px; display: grid; place-items: center; border-radius: 15px; color: var(--green-dark); background: var(--green-soft); font-size: 22px; font-weight: 900; }
.confirm-dialog h2 { margin: 0; font-size: 27px; line-height: 1.1; letter-spacing: -0.045em; }
.confirm-dialog > p:not(.eyebrow) { margin: 13px 0 25px; color: var(--muted); line-height: 1.55; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; }
.secondary-button { min-height: 50px; border-radius: 14px; color: #4f5952; background: #edf1ed; }

.login-page {
  min-height: 100vh;
  padding: 35px 20px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(185, 236, 117, 0.2), transparent 32rem),
    linear-gradient(180deg, #f8faf7, #eef3ee);
}

.login-card {
  width: min(460px, 100%);
  padding: 40px;
  border: 1px solid rgba(23, 32, 25, 0.09);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(29, 48, 35, 0.13);
}

.login-brand {
  margin-bottom: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.login-brand > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--ink);
}

.login-card h1 { font-size: 42px; line-height: 1; }
.login-lede { margin: 16px 0 27px; color: var(--muted); line-height: 1.6; }
.login-card .form-error { margin: 0 0 18px; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; color: #4c574f; font-size: 12px; font-weight: 750; }
.login-form input { width: 100%; height: 52px; padding: 0 15px; border: 1px solid #d9e0d9; border-radius: 13px; outline: none; background: #fbfcfa; }
.login-form input:focus { border-color: #6ab78a; background: #fff; box-shadow: 0 0 0 4px rgba(76, 169, 112, 0.12); }
.login-form .primary-button { width: 100%; }
.login-security { margin-top: 26px; padding-top: 22px; display: flex; gap: 11px; border-top: 1px solid var(--line); color: #738078; font-size: 11px; line-height: 1.5; }
.login-security > span { flex: 0 0 auto; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: var(--green-dark); background: var(--green-soft); font-weight: 900; }
.login-security p { margin: 0; }
.login-security strong { color: #526057; }

@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 17px; }
  .brand { font-size: 17px; }
  .brand > span { width: 35px; height: 35px; }
  .account > span:not(.account-dot) { display: none; }
  .account a { margin-left: 3px; padding-left: 13px; }
  .shell { width: min(100% - 28px, 620px); padding: 38px 0 58px; }
  .hero { align-items: stretch; flex-direction: column; gap: 24px; }
  h1 { font-size: 42px; }
  .lede { font-size: 14px; }
  .view-switch { align-self: stretch; }
  .view-switch a { flex: 1; justify-content: center; }
  .add-card { padding: 21px; border-radius: 20px; }
  .client-form { grid-template-columns: 1fr; gap: 15px; }
  .url-field, .reason-field, .client-form .primary-button { grid-column: auto; }
  .client-form .primary-button { width: 100%; justify-self: stretch; }
  .list-section { margin-top: 38px; }
  .client-card { grid-template-columns: 5px minmax(0, 1fr); }
  .client-main { padding: 21px 18px 17px; }
  .client-title-row { gap: 10px; }
  .client-title-row h3 { font-size: 20px; }
  .active-badge, .archive-badge { padding: 0 9px; font-size: 9px; }
  .reason { margin-bottom: 16px; font-size: 14px; }
  .client-action { grid-column: 2; min-width: 0; padding: 0 18px 20px; border: 0; background: transparent; }
  .client-action form { width: 100%; }
  footer { width: calc(100% - 28px); flex-direction: column; gap: 7px; }
}

@media (max-width: 430px) {
  .list-heading { align-items: flex-start; }
  .live-summary { margin-top: 8px; }
  .client-title-row { flex-direction: column; }
  .active-badge, .archive-badge { order: -1; }
  .client-links { flex-direction: column; }
  .phone-link, .backoffice-link { justify-content: center; }
  .dialog-actions { grid-template-columns: 1fr; }
  .login-page { padding: 16px; }
  .login-card { padding: 28px 22px; border-radius: 22px; }
  .login-brand { margin-bottom: 34px; }
  .login-card h1 { font-size: 37px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
