/* SoftwareMagic dashboard
   Palette dal sito softwaremagic.it:
   blu #0066CC · blu chiaro #3399FF · testo #1d1d1f · sfondo #f5f5f7 · bordi #e5e7eb */

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

:root {
  --blue: #0066CC;
  --blue-dark: #0055aa;
  --blue-light: #3399FF;
  --bg: #f5f5f7;
  --card: #ffffff;
  --line: #e5e7eb;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --ok: #1a7f4e;
  --ok-bg: #e8f5ee;
  --err: #c93838;
  --err-bg: #fbecec;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ------- barra laterale ------- */

body.app { display: flex; align-items: stretch; }

.sidebar {
  width: 220px;
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.brand { display: flex; align-items: center; padding: 0 .4rem; }
.brand img { height: 34px; width: auto; display: block; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1;
  margin-top: 1.6rem;
}

.sidebar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: .55rem .9rem;
  border-radius: 8px;
  font-weight: 500;
  transition: color .15s, background .15s;
}

.sidebar nav a:hover { color: var(--ink); background: var(--bg); }
.sidebar nav a.active { color: var(--blue); background: #eaf3fc; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: .9rem .4rem 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  font-size: .88rem;
}
.user-chip { color: var(--muted); word-break: break-word; }
.sidebar-foot .logout {
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--line);
  padding: .32rem .85rem; border-radius: 8px;
  text-align: center;
}
.sidebar-foot .logout:hover { background: var(--bg); }

main {
  flex: 1;
  min-width: 0;
  max-width: 1000px;
  margin: 1.8rem auto 3rem;
  padding: 0 1.4rem;
}

/* ------- card ------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
  margin-bottom: 1.4rem;
}

.card h2 { font-size: 1.12rem; font-weight: 600; margin-bottom: 1rem; }
.card h4 {
  font-size: .76rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: .6rem;
}

/* ------- form ------- */

.create-form { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: .35rem; }
label { font-size: .82rem; font-weight: 600; color: var(--muted); }

.inline { display: flex; align-items: center; gap: .5rem; }

input[type="text"], input[type="email"], input[type="password"], select {
  padding: .58rem .8rem;
  border: 1px solid #d2d2d7;
  border-radius: 9px;
  font-size: .95rem;
  font-family: inherit;
  min-width: 170px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}

input:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .15);
}

input:disabled { background: var(--bg); color: var(--muted); }

.suffix { color: var(--muted); font-weight: 600; white-space: nowrap; }

button {
  padding: .55rem 1rem;
  border: 1px solid #d2d2d7;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: .88rem;
  font-family: inherit;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}

button:hover { background: var(--bg); }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}

button.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

button.danger { color: var(--err); border-color: #ecc9c9; }
button.danger:hover { background: var(--err-bg); }
button.wide { width: 100%; margin-top: 1rem; }
button.linklike {
  border: none; background: none; color: var(--blue);
  text-decoration: underline; padding: 0; font-size: .87rem;
}
button.linklike:hover { background: none; }

.alt-form { margin-top: .9rem; }

.hint { color: var(--muted); font-size: .85rem; margin-top: .8rem; }
.hint a { color: var(--blue); }
.muted { color: var(--muted); }

/* ------- tabelle ------- */

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

/* bordi separati: servono per arrotondare gli angoli della tabella */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

th, td {
  text-align: left;
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--line);
  font-size: .93rem;
  vertical-align: middle;
}

thead th {
  background: #fafafb;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-top: .55rem;
  padding-bottom: .55rem;
  white-space: nowrap;
}

thead th:first-child { border-top-left-radius: 9px; }
thead th:last-child { border-top-right-radius: 9px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 9px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 9px; }

tbody td:first-child { font-weight: 600; }
tbody tr:hover td { background: #f8fafc; }

td a { color: var(--blue); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

td.actions, th:last-child { text-align: right; }
td.actions { padding-top: .45rem; padding-bottom: .45rem; }
td.actions button { padding: .38rem .8rem; font-size: .83rem; }

.domains-table .row-main { cursor: pointer; }

.row-detail td,
.row-detail:hover td { background: #fafafa; font-weight: 400; }
.row-detail td { padding: 1.1rem 1.2rem; }

.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}

.cred-grid dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; align-items: center; }
.cred-grid dt { color: var(--muted); font-size: .82rem; }

.copy {
  position: relative;
  display: inline-block;
  background: #f0f0f2;
  border: 1px solid var(--line);
  padding: .12rem .5rem;
  border-radius: 6px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .82rem;
  cursor: copy;
  word-break: break-all;
  transition: background .15s;
}

.copy:hover { background: #e8e8ec; }
.copy::after {
  content: attr(data-label);
  position: absolute;
  top: -1.55rem; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.copy:hover::after { opacity: 1; }
.copy.copied { background: var(--ok-bg); border-color: #c4e5d2; }

.ftp-table { margin-bottom: .8rem; }
.ftp-table td, .ftp-table th { padding: .45rem .5rem; font-size: .88rem; }

.ftp-add { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ftp-add .prefix {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  color: var(--muted);
}
.ftp-add input { min-width: 110px; padding: .45rem .6rem; font-size: .87rem; }
.ftp-add button { padding: .45rem .8rem; font-size: .84rem; }

.email-hint {
  margin-top: 1.1rem;
  background: #eaf3fc;
  border: 1px solid #cfe3f7;
  border-radius: 9px;
  padding: .7rem .9rem;
  font-size: .86rem;
  color: #1d4e89;
}
.email-hint a { color: #1d4e89; font-weight: 600; }

.actions { display: flex; gap: .4rem; justify-content: flex-end; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .18rem .65rem;
  border-radius: 999px;
  font-size: .77rem;
  font-weight: 600;
  background: #f0f0f2;
  color: var(--muted);
}

.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.plain::before { display: none; }

/* ------- flash ------- */

.flash {
  padding: .8rem 1.1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: .92rem;
  border: 1px solid transparent;
}

.flash.ok { background: var(--ok-bg); color: #135f3a; border-color: #c9e8d6; }
.flash.warning { background: #fdf4dd; color: #7a5a00; border-color: #f0e0ae; }
.flash.error { background: var(--err-bg); color: #a52f2f; border-color: #f2caca; }
.flash.info { background: #eaf3fc; color: #1d4e89; border-color: #cfe3f7; }

/* ------- pagine di accesso ------- */

body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

body.auth main { margin: 0; width: 100%; max-width: 430px; }

.auth-card {
  text-align: center;
  padding: 2.4rem 2.1rem 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06);
}

.auth-logo { height: 52px; width: auto; margin-bottom: 1.1rem; }

.auth-card h1 { font-size: 1.3rem; font-weight: 600; margin-bottom: .2rem; }
.auth-card .sub { color: var(--muted); font-size: .88rem; }
.auth-card form { text-align: left; margin-top: 1.4rem; }
.auth-card input[type="email"], .auth-card .code-input { width: 100%; margin-top: .35rem; }

.code-input {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.35rem !important;
  letter-spacing: .35em;
  text-align: center;
}

.checkline {
  display: flex; align-items: center; gap: .55rem;
  margin-top: 1rem; font-size: .87rem; color: var(--ink);
  font-weight: 400; text-transform: none; letter-spacing: 0;
}
.checkline input { accent-color: var(--blue); width: 16px; height: 16px; }

.qr {
  width: 190px; height: 190px; margin: .6rem 0;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}

code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .85em; }

/* ------- intestazione card e pagina ------- */

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-head h2 { margin-bottom: 0; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.page-head h1 { font-size: 1.4rem; font-weight: 600; word-break: break-all; }
.breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: .15rem; }
.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn-git { display: inline-flex; align-items: center; gap: .45rem; }
.btn-git svg { flex: none; }

.icon-btn {
  padding: .45rem .55rem;
  line-height: 1;
  flex: none;
}

/* ------- pagina di dettaglio ------- */

.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.4rem;
}

input.ro {
  background: var(--bg);
  border-color: var(--line);
  color: var(--ink);
  cursor: default;
}
input.ro:focus-visible { box-shadow: none; border-color: var(--line); }

.edit-only { display: none; }
body.editing .edit-only { display: inline-flex; align-items: center; }

.prefix {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  color: var(--muted);
}

.ftp-table input { min-width: 130px; width: 100%; }
.ftp-table .inline { flex-wrap: nowrap; }

/* ------- pagina profilo ------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.3rem 1.7rem;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .02em;
  flex: none;
  text-transform: uppercase;
}

.profile-id { flex: 1; min-width: 0; }
.profile-id h1 { font-size: 1.25rem; font-weight: 600; }
.profile-id p { font-size: .9rem; }
.profile-badges { flex: none; }

.settings-row {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.2rem 2.4rem;
  align-items: start;
}

.settings-info h2 { font-size: 1rem; font-weight: 600; margin-bottom: .35rem; }
.settings-info p { font-size: .84rem; color: var(--muted); line-height: 1.5; }

.settings-body { min-width: 0; }

.status-line { margin-bottom: .8rem; }

.stack-form { display: flex; flex-direction: column; gap: .8rem; max-width: 340px; }
.stack-form input { width: 100%; }

.setup-steps { margin: 0 0 .4rem 1.1rem; display: flex; flex-direction: column; gap: 1rem; }
.setup-steps li { font-size: .92rem; }

@media (max-width: 720px) {
  .settings-row { grid-template-columns: 1fr; gap: .8rem; }
  .profile-head { flex-wrap: wrap; }
}

/* ------- lightbox / wizard ------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 31, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.2rem;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 470px;
  padding: 1.4rem 1.6rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}

.modal-head h3 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  padding: .1rem .4rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--ink); background: none; }

.wiz-dots { display: flex; gap: .4rem; margin-bottom: 1.1rem; }
.wiz-dots .dot {
  width: 26px; height: 4px;
  border-radius: 999px;
  background: var(--line);
}
.wiz-dots .dot.active { background: var(--blue); }

.wiz-step label { display: block; margin-bottom: .3rem; }
.wiz-step .inline input { flex: 1; min-width: 0; }

.wiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.3rem;
}

.wiz-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .4rem 1rem;
  margin: .9rem 0;
  align-items: center;
}
.wiz-summary dt { color: var(--muted); font-size: .84rem; }
.wiz-summary dd {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .88rem;
  word-break: break-all;
}

.steps-list { list-style: none; margin: 1rem 0 .4rem; }
.steps-list li {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .42rem 0;
  font-size: .93rem;
  color: var(--muted);
}
.steps-list li.step-ok { color: var(--ink); }
.steps-list li.step-running { color: var(--blue); font-weight: 600; }
.steps-list li.step-error { color: var(--err); font-weight: 600; }
.steps-list li.step-warn { color: #7a5a00; }

.step-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  flex: none;
}
.step-ok .step-icon { background: var(--ok-bg); border-color: #c4e5d2; color: var(--ok); }
.step-running .step-icon {
  border-color: var(--blue);
  color: var(--blue);
  animation: pulse 1s ease-in-out infinite;
}
.step-error .step-icon { background: var(--err-bg); border-color: #ecc9c9; color: var(--err); }
.step-warn .step-icon { background: #fdf4dd; border-color: #f0e0ae; color: #7a5a00; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ------- console ------- */

.btn-code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-weight: 700;
  letter-spacing: .05em;
}

body.console main {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex: none;
}
.console-head .breadcrumb { margin-bottom: 0; }
#preview-status { font-size: .82rem; white-space: nowrap; }

.console-tools { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.console-tools button { padding: .42rem .8rem; font-size: .82rem; }

.seg {
  display: flex;
  border: 1px solid #d2d2d7;
  border-radius: 9px;
  overflow: hidden;
}
.seg-btn {
  border: none;
  border-radius: 0;
  padding: .42rem .8rem;
  font-size: .82rem;
}
.seg-btn + .seg-btn { border-left: 1px solid #d2d2d7; }
.seg-btn.active { background: var(--blue); color: #fff; }
.seg-btn.active:hover { background: var(--blue-dark); }

.console-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 44%) 1fr;
  min-height: 0;
}

.console-left {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
}

.claude-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.claude-out {
  flex: 1;
  overflow-y: auto;
  padding: .9rem 1rem;
  font-size: .9rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.cc-user {
  color: var(--blue);
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--line);
  padding-top: .55rem;
}
.cc-user:first-child { border-top: none; padding-top: 0; }
.cc-text { white-space: pre-wrap; word-break: break-word; }
.cc-tool {
  color: var(--muted);
  font-size: .8rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  word-break: break-all;
}
.cc-err { color: var(--err); white-space: pre-wrap; word-break: break-word; }
.cc-notice { color: var(--muted); font-size: .8rem; font-style: italic; }

.claude-input {
  border-top: 1px solid var(--line);
  padding: .7rem .9rem;
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  flex: none;
}
.claude-input textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  padding: .55rem .8rem;
  border: 1px solid #d2d2d7;
  border-radius: 9px;
  font-size: .92rem;
  font-family: inherit;
  color: var(--ink);
}
.claude-input textarea:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .15);
}
.claude-actions { display: flex; flex-direction: column; gap: .4rem; }

.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .8rem;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.editor-bar select {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .82rem;
  padding: .35rem .5rem;
}
#editor-state { font-size: .78rem; white-space: nowrap; }

#editor {
  flex: 1;
  border: none;
  resize: none;
  padding: .8rem 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .84rem;
  line-height: 1.45;
  color: var(--ink);
  background: #fff;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
#editor:disabled { background: var(--bg); }

.console-right {
  position: relative;
  display: flex;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

/* spinner mostrato sopra l'anteprima mentre il sito ricarica */
.preview-spin {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .6);
  z-index: 5;
}
.preview-spin::after {
  content: '';
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  animation: smspin .8s linear infinite;
}
.console-right iframe { flex: 1; width: 100%; border: none; }

.console-right.w-tablet, .console-right.w-mobile { background: var(--bg); }
.console-right.w-tablet iframe, .console-right.w-mobile iframe {
  flex: none;
  height: 100%;
  max-width: 100%;
  background: #fff;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.console-right.w-tablet iframe { width: 768px; }
.console-right.w-mobile iframe { width: 390px; }

input[type="file"] {
  width: 100%;
  padding: .45rem .5rem;
  border: 1px solid #d2d2d7;
  border-radius: 9px;
  background: #fff;
  font-size: .88rem;
  font-family: inherit;
}

@media (max-width: 900px) {
  .console-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .console-left { border-right: none; border-bottom: 1px solid var(--line); }
  body.console main { height: auto; min-height: 100vh; }
}

/* ------- file manager ------- */

.fm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.fm-path {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  color: var(--muted);
  word-break: break-all;
}
.fm-path a { color: var(--blue); text-decoration: none; }
.fm-path a:hover { text-decoration: underline; }

.fm-actions-bar { display: flex; gap: .5rem; flex-wrap: wrap; }

.fm-table .fm-name { cursor: pointer; word-break: break-all; }
.fm-table .fm-name:hover { color: var(--blue); }
.fm-table td, .fm-table th { padding: .5rem .6rem; font-size: .9rem; }
.fm-table .actions button { padding: .4rem .7rem; font-size: .8rem; }

.modal.wide { max-width: 900px; }

#fm-editor {
  width: 100%;
  height: 62vh;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .8rem 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .84rem;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre;
  tab-size: 2;
}
#fm-editor:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .15);
}

/* ------- varie ------- */

@media (max-width: 720px) {
  body.app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: .9rem;
    padding: .6rem 1rem;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand img { height: 28px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .sidebar nav a { padding: .4rem .7rem; }
  .sidebar-foot {
    border-top: none;
    padding: 0;
    flex-direction: row;
    align-items: center;
    margin-left: auto;
  }
  .sidebar-foot .user-chip { display: none; }
}

@media (max-width: 640px) {
  .create-form { align-items: stretch; flex-direction: column; }
  .actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------- permessi operatore (pagina utenti) ------- */

.perm-box {
  flex-basis: 100%;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .35rem 1rem .9rem;
}
.perm-box .checkline { margin-top: .55rem; }
.perm-sites { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.perm-list {
  margin-top: .7rem; padding-top: .25rem;
  border-top: 1px solid var(--line);
  max-height: 220px; overflow-y: auto;
}

/* ------- esplora file nella console ------- */

.xp-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}
.xp-bar {
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.xp-tools { display: flex; gap: .35rem; flex-wrap: wrap; }
.xp-tools button { padding: .45rem .7rem; font-size: 1.15rem; line-height: 1; }
.xp-msg { margin: .5rem .8rem 0; }
.xp-list {
  flex: 1;
  overflow-y: auto;
  padding: .3rem 0;
}
.xp-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .28rem .9rem;
  cursor: pointer;
  font-size: .85rem;
  user-select: none;
}
.xp-row:hover { background: var(--bg); }
.xp-row.sel { background: rgba(0, 102, 204, .12); }
.xp-ico { flex: none; font-size: 1.25rem; line-height: 1; }
.xp-name { flex: 1; min-width: 0; word-break: break-all; }
.xp-size { flex: none; font-size: .78rem; }
.xp-list .hint { padding: .6rem .9rem; }

/* vista a griglia */
.xp-list.grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: .35rem;
  padding: .6rem;
}
.xp-list.grid .xp-row {
  flex-direction: column;
  justify-content: flex-start;
  width: 104px;
  padding: .55rem .3rem;
  border-radius: 9px;
  text-align: center;
  gap: .2rem;
}
.xp-list.grid .xp-ico { font-size: 2.3rem; line-height: 1.1; }
.xp-list.grid .xp-name {
  flex: none;
  width: 100%;
  font-size: .72rem;
  line-height: 1.25;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.xp-list.grid .xp-size { display: none; }
.xp-list.grid .hint { width: 100%; }

#xp-editor {
  width: 100%;
  height: 56vh;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .8rem 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  line-height: 1.5;
}
#xp-editor:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .15);
}

.xp-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.xp-viewer img { max-width: 100%; max-height: 68vh; }
.xp-viewer video { max-width: 100%; max-height: 68vh; }
.xp-viewer audio { width: 100%; }

.xp-move-list {
  border: 1px solid var(--line);
  border-radius: 9px;
  max-height: 300px;
  margin-top: .5rem;
}

/* schede File manager / Plugin / Temi */
.console-left section[hidden] { display: none; }
.xp-tabs {
  flex: none;
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 .5rem;
}
.xp-tab {
  border: none;
  background: none;
  border-radius: 0;
  padding: .55rem .9rem;
  font-size: .82rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.xp-tab:hover { color: var(--ink); background: none; }
.xp-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

/* elenco plugin con pulsante di esportazione */
.ext-row { cursor: default; }
.ext-row button { flex: none; padding: .3rem .7rem; font-size: .78rem; }

/* schede dei temi con anteprima */
.ext-themes {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: .7rem;
  padding: .8rem;
}
.ext-theme {
  width: 172px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.ext-theme .shot {
  width: 100%;
  height: 118px;
  object-fit: cover;
  object-position: top;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex: none;
}
.ext-theme .ext-name {
  padding: .45rem .55rem .1rem;
  font-size: .78rem;
  line-height: 1.3;
  word-break: break-word;
  flex: 1;
}
.ext-theme button {
  margin: .45rem .55rem .55rem;
  padding: .3rem .7rem;
  font-size: .75rem;
  align-self: flex-start;
}

/* menu Modifica dell'editor */
.xp-menu { position: relative; }
.xp-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .14);
  display: flex;
  flex-direction: column;
  min-width: 170px;
  padding: .3rem;
  z-index: 40;
}
.xp-menu-list[hidden] { display: none; }
.xp-menu-list button {
  border: none;
  background: none;
  text-align: left;
  padding: .45rem .7rem;
  font-size: .82rem;
  border-radius: 6px;
}
.xp-menu-list button:hover { background: var(--bg); }

/* elenco dei browser autorizzati nel profilo */
.trust-table { margin-bottom: .8rem; }
.trust-table td { font-size: .88rem; }
.trust-table .badge { margin-left: .4rem; }

/* spinner di caricamento nelle lightbox */
.xp-spin {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.xp-spin::after {
  content: '';
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  animation: smspin .8s linear infinite;
}
@keyframes smspin { to { transform: rotate(360deg); } }
