/* Presentation layer shared by the login and tools hub. */
:root {
  color-scheme: dark;
  --viola: #c4afff;
  --viola-scuro: #191522;
  --viola-notte: #231a36;
  --verde: #c4afff;
  --verde-scuro: #d5c5ff;
  --bianco: #f1edf7;
  --grigio: #b4adbf;
  --rosso: #ff92a3;
  --card: #211d2b;
  --bordo: #393243;
  --surface: #141218;
  --soft: #30283f;
  --mint: #b9f3d7;
  --focus: #c4afff;
  --input-border: #746981;
}
html { scrollbar-color: #62556f var(--surface); scroll-padding-top: 120px; }
body {
  background: var(--surface);
  color: var(--bianco);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #dcd2f1; color: #231a36; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input, textarea, select { caret-color: var(--viola); }
.pitch, .glow { display: none; }
.brand-logo { width: 42px; height: 42px; flex: 0 0 auto; object-fit: contain; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--mint);
  color: var(--viola-notte);
  border-radius: 10px;
  font-family: 'Archivo', sans-serif;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -.06em;
}

/* Workspace: quiet content canvas and a distinct brand rail. */
.app { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  background: var(--viola-scuro);
  border: 0;
  padding: 36px 20px 24px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #fff;
  overflow-y: auto;
}
.brand { gap: 10px; margin-bottom: 54px; }
.brand-name { font-size: 19px; letter-spacing: -.025em; line-height: 1.15; }
.brand-name .accent { color: #fff; }
.brand-name small { color: #d1c6e5; font-size: 11px; letter-spacing: .12em; margin-top: 6px; }
.side-section { font-size: 12px; letter-spacing: 0; text-transform: none; color: #c6b9dc; padding-left: 12px; margin-bottom: 12px; }
.side-actions { gap: 8px; }
.side-btn {
  min-height: 48px;
  padding: 12px;
  gap: 9px;
  border-radius: 9px;
  color: #eee8f8;
  font-size: 13px;
  font-weight: 500;
}
.side-btn .dot { background: #b8a5d1; width: 6px; height: 6px; }
.side-btn:hover { background: #443160; border-color: transparent; }
.side-btn.on { background: #564174; border-color: #9481ae; }
.side-btn.on .dot { background: var(--mint); box-shadow: none; }
.side-btn:focus-visible { outline-color: var(--mint); }
.side-footer { color: #c6b9dc; font-size: 11px; text-transform: none; letter-spacing: 0; padding: 32px 12px 0; }
.content { width: 100%; max-width: 1512px; margin-inline: auto; padding: 52px clamp(24px, 4vw, 64px) 80px; }
.hero { position: relative; padding-bottom: 28px; margin-bottom: 24px; border-bottom: 1px solid var(--bordo); }
.hero h1 { font-size: clamp(34px, 3.6vw, 48px); font-weight: 750; font-stretch: 95%; letter-spacing: -.035em; text-transform: none; line-height: 1.15; }
.area-label { float: right; color: var(--grigio); font-size: 12px; padding: 7px 12px; border: 1px solid var(--bordo); border-radius: 6px; margin-top: 8px; }
.hero .count { font-size: 14px; margin-top: 10px; }
.hero .count b { color: var(--bianco); font-weight: 600; font-variant-numeric: tabular-nums; }
.searchbar { max-width: 640px; margin-bottom: 40px; }
.searchbar input {
  padding: 16px 18px 16px 50px;
  background: var(--card);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--bianco);
  font-size: 15px;
}
.searchbar input::placeholder, input::placeholder, textarea::placeholder { color: var(--grigio); }
.searchbar input:focus, input:focus, textarea:focus {
  border-color: var(--viola);
  box-shadow: 0 0 0 3px #c4afff26;
  outline: none;
}

/* Categories remain driven by the saved section colors. */
.section-block, .section-block.tinted {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  margin-bottom: 36px;
}
.section-title { gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-title h2, .section-block.tinted .section-title h2 {
  color: var(--bianco);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.015em;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
}
.section-title::after { background: var(--bordo); min-width: 20px; }
.section-title .badge, .section-block.tinted .badge {
  border: 0;
  background: var(--soft);
  color: var(--bianco);
  font-size: 11px;
  line-height: 1.8;
  min-width: 25px;
  padding: 0 7px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.section-block.tinted .badge { background: color-mix(in srgb, var(--tint) 18%, var(--card)); color: var(--bianco); }
.links-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.link-card {
  grid-template-columns: 46px minmax(0, 1fr) 22px;
  min-height: 106px;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 12px;
  transition: border-color .16s, background-color .16s;
}
.link-card:hover { transform: none; background: #2b2437; border-color: #9985b7; }
.link-card .icon { width: 46px; height: 46px; border: 0; border-radius: 10px; background: var(--soft); font-size: 23px; }
.section-block.tinted .link-card .icon { background: color-mix(in srgb, var(--tint) 13%, var(--card)); }
.link-card h3 { font-size: 16px; font-weight: 700; font-stretch: 100%; letter-spacing: -.015em; text-transform: none; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; margin-bottom: 5px; }
.link-card p { font-size: 13px; line-height: 1.6; }
.link-card .go { font-size: 20px; color: var(--grigio); font-weight: 400; }
.link-card:hover .go { color: var(--viola); transform: none; }
.empty-state, .section-empty { background: var(--card); border: 1px dashed #62556f; color: var(--grigio); border-radius: 10px; padding: 28px 20px; }
body.admin .link-card { grid-template-columns: 12px 46px minmax(0, 1fr) 22px; }
.link-actions { border-top: 1px solid var(--bordo); }
.link-actions button { min-height: 40px; font-weight: 600; }
.edit-btn { background: var(--soft); color: var(--viola); }
.delete-btn { background: #422630; }
.section-tools button { background: var(--card); color: var(--grigio); min-height: 36px; min-width: 36px; }
.section-tools button:hover { border-color: var(--viola); }
.add-section-btn { border-color: #b0a4c6; font-weight: 600; letter-spacing: 0; text-transform: none; border-radius: 10px; }
.add-section-btn:hover { background: var(--soft); }

/* Forms, admin dialogs and service credentials share the same controls. */
input, textarea, select { background: var(--surface); border: 1px solid var(--input-border); border-radius: 8px; color: var(--bianco); }
#linkSection { background: var(--surface) !important; border: 1px solid var(--input-border) !important; border-radius: 8px !important; }
.modal { background: #07060bbf; backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal-content { background: var(--card); border: 0; border-radius: 16px; padding: 32px; box-shadow: 0 24px 80px #0008; animation: none; }
.modal-content h2 { font-size: 24px; font-weight: 700; text-transform: none; font-stretch: 100%; letter-spacing: -.025em; }
.form-group label { color: var(--grigio); text-transform: none; letter-spacing: 0; }
.btn { text-transform: none; letter-spacing: 0; border-radius: 8px; font-size: 14px; min-height: 46px; }
.btn-primary, .credential-edit-btn, .add-link-btn { background: var(--viola); color: var(--viola-notte); box-shadow: none; }
.btn-primary:hover, .credential-edit-btn:hover { background: var(--verde-scuro); }
.btn-secondary { background: var(--soft); color: var(--bianco); }
.btn:hover, .link-actions button:hover { transform: none; }
.credentials-box {
  visibility: hidden;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility .35s;
  background: var(--card);
  border-left: 1px solid var(--bordo);
  width: 390px;
  padding: 32px 24px;
  box-shadow: -16px 0 48px #0005;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.credentials-box.visible { visibility: visible; }
.credential-item { background: var(--surface); border: 1px solid var(--bordo); border-radius: 10px; }
.credential-item h4 { text-transform: none; letter-spacing: 0; font-stretch: 100%; }
.credential-item p strong { color: var(--viola); }
.credential-edit-btn { min-height: 36px; }
.drawer-close { width: 40px; height: 40px; background: var(--soft); color: var(--bianco); }
.loading { background: var(--card); border: 1px solid var(--bordo); padding: 16px 24px; border-radius: 12px; font-size: 14px; text-transform: none; letter-spacing: 0; box-shadow: 0 12px 36px #0005; }

/* Access page: the same wordmark, clean canvas and focused form. */
.login-page { min-height: 100svh; height: auto; overflow: auto; padding: 40px 24px; background: var(--surface); }
.login-page .card { max-width: 448px; padding: 44px 40px 30px; background: var(--card); border: 1px solid var(--bordo); border-radius: 16px; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; animation: none; }
.login-page .logo-wrap { width: 56px; height: 56px; margin: 0 auto 24px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.login-page .brand-logo { width: 56px; height: 56px; }
.login-page .brand-mark { font-size: 27px; border-radius: 12px; }
.login-page h1 { font-size: 34px; font-stretch: 85%; letter-spacing: -.03em; line-height: 1.15; }
.login-page h1 .accent { color: inherit; }
.login-page .tag { font-size: 14px; letter-spacing: 0; text-transform: none; margin: 12px 0 36px; }
.login-page .tag::before, .login-page .tag::after { content: none; }
.login-page label { text-transform: none; letter-spacing: 0; color: var(--grigio); font-size: 13px; }
.login-page .field input { background: var(--surface); border: 1px solid var(--input-border); border-radius: 8px; padding: 15px 56px 15px 16px; font-size: 16px; }
.login-page .field input::placeholder { color: var(--grigio); }
.login-page .field input:focus { border-color: var(--viola); box-shadow: 0 0 0 3px #c4afff26; }
.login-page .field input.error { border-color: var(--rosso); box-shadow: 0 0 0 3px #bd304714; }
.login-page .toggle { width: 44px; height: 44px; right: 5px; }
.login-page .toggle:hover { background: var(--soft); }
.login-page .login-btn { min-height: 50px; padding: 14px; background: var(--viola); color: var(--viola-notte); border-radius: 8px; box-shadow: none; font-family: inherit; font-weight: 600; font-size: 15px; text-transform: none; letter-spacing: 0; transition: background-color .16s; }
.login-page .login-btn:hover { background: var(--verde-scuro); transform: none; box-shadow: none; }
.login-page .login-btn:focus-visible { outline-color: var(--focus); }
.login-page .footer { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--bordo); font-size: 11px; color: var(--grigio); letter-spacing: 0; text-transform: none; }

@media (max-width: 1100px) and (min-width: 961px) {
  .app { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { padding-inline: 16px; }
  .brand-name { font-size: 17px; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { height: auto; overflow: visible; padding: 14px 24px; gap: 16px; background: var(--viola-scuro); }
  .brand { margin: 0; }
  .brand-name { font-size: 18px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-mark { font-size: 18px; border-radius: 8px; }
  .side-btn { min-height: 44px; min-width: 44px; justify-content: center; padding: 10px; }
  .side-btn .label { display: inline; }
  #sideAddBtn { display: none !important; }
  .content { padding: 36px 28px 96px; }
  .links-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); }
  .hero h1 { font-size: 38px; }
  .searchbar { max-width: none; margin-bottom: 32px; }
  .add-link-btn { bottom: 24px; right: 24px; border-radius: 14px; box-shadow: 0 8px 24px #30204f26; }
}
@media (max-width: 600px) {
  .sidebar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .brand { flex: 1 0 100%; }
  .brand-name small { display: inline; letter-spacing: .04em; font-size: 10px; margin-left: 8px; }
  .side-actions { width: 100%; gap: 8px; }
  .side-btn { flex: 1; background: #402d5c; font-size: 12px; padding: 10px 8px; }
  .content { padding: 28px 16px 100px; }
  .hero { padding-bottom: 22px; margin-bottom: 22px; }
  .hero h1 { font-size: 34px; }
  .area-label { margin-top: 5px; padding: 5px 8px; font-size: 11px; }
  .links-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .link-card { padding: 16px; gap: 12px; min-height: 96px; }
  .link-card p { -webkit-line-clamp: 2; font-size: 13px; }
  body.admin .link-card { grid-template-columns: 12px 38px minmax(0, 1fr) 18px; gap: 8px; }
  body.admin .link-card .icon { width: 38px; height: 38px; font-size: 20px; }
  .section-block { margin-bottom: 30px; }
  .modal { padding: 16px; }
  .modal-content { padding: 24px 20px; max-height: 88svh; }
  .credentials-box { padding: 28px 18px; }
  .form-actions { gap: 8px; }
  .btn { padding-inline: 12px; }
  .login-page { padding: 32px 16px; }
  .login-page .card { padding: 32px 24px 24px; }
  .login-page h1 { font-size: 31px; }
}
@media (max-height: 520px) and (max-width: 960px) {
  .sidebar { position: relative; }
  .login-page { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
