:root {
  --bg-grad-1: #e6ecf3;
  --bg-grad-2: #eef1f5;
  --bg-grad-3: #e2ebee;
  --card-bg: rgba(255,255,255,0.6);
  --card-border: rgba(255,255,255,0.7);
  --card-shadow: rgba(15,30,60,0.12);
  --field-bg: rgba(255,255,255,0.5);
  --sidebar-bg: rgba(255,255,255,0.45);
  --text: #111827;
  --text-muted: #5b6472;
  --border: rgba(17,24,39,0.1);
  --accent: #2563eb;
  --accent-2: #38bdf8;
  --accent-soft: rgba(37,99,235,0.12);
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #10b981;
  --warning: #d97706;
  --blob-1: #2563eb;
  --blob-2: #334155;
  --blob-3: #0ea5e9;
  --radius: 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg-grad-1: #0a0e14;
  --bg-grad-2: #0f1720;
  --bg-grad-3: #0b1220;
  --card-bg: rgba(22,27,38,0.6);
  --card-border: rgba(255,255,255,0.08);
  --card-shadow: rgba(0,0,0,0.45);
  --field-bg: rgba(255,255,255,0.04);
  --sidebar-bg: rgba(10,14,20,0.6);
  --text: #eef2f7;
  --text-muted: #99a2b5;
  --border: rgba(255,255,255,0.09);
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --accent-soft: rgba(59,130,246,0.18);
  --accent-dark: #60a5fa;
  --blob-1: #1d4ed8;
  --blob-2: #0e7490;
  --blob-3: #1e293b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(120deg, var(--bg-grad-1), var(--bg-grad-2) 50%, var(--bg-grad-3));
  background-size: 200% 200%;
  animation: gradientShift 22s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

a { color: var(--accent); text-decoration: none; }

.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.bg-blob.b1 { width: 420px; height: 420px; background: var(--blob-1); top: -100px; left: -100px; }
.bg-blob.b2 { width: 380px; height: 380px; background: var(--blob-2); bottom: -120px; right: -80px; }
.bg-blob.b3 { width: 320px; height: 320px; background: var(--blob-3); top: 45%; right: 15%; opacity: 0.22; }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.login-box {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 20px 50px var(--card-shadow);
  width: 320px;
  position: relative;
}
.login-box h1 {
  margin: 0 0 24px;
  font-size: 22px;
  text-align: center;
}
.login-box label {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-box input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 10px;
  font-size: 14px;
}
.login-box button {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--accent-soft);
}
.login-box button:hover { filter: brightness(1.08); }
.login-box .error {
  background: rgba(220,38,38,0.12);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* App layout */
.app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--card-border);
  color: var(--text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 28px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .brand::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
  flex-shrink: 0;
}
.sidebar a {
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
  display: block;
}
.sidebar a:hover { background: var(--accent-soft); color: var(--text); }
.sidebar a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px var(--accent-soft);
}

.theme-toggle-row {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--text-muted);
}
.theme-switch {
  width: 38px;
  height: 21px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.theme-switch::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
html[data-theme="dark"] .theme-switch { background: var(--accent); }
html[data-theme="dark"] .theme-switch::after { transform: translateX(17px); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-footer a { color: var(--text-muted); font-size: 12px; }

.content {
  margin-left: 220px;
  padding: 32px 40px;
  width: 100%;
  position: relative;
  min-width: 0;
}
.content h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; }
.subtitle { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; text-transform: capitalize; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Grid / cards */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 22px;
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 32px var(--card-shadow);
  min-width: 0;
}
.card-wide { grid-column: 1 / -1; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}
.card-header h2 { font-size: 15px; margin: 0; font-weight: 600; }
.note-status { font-size: 12px; color: var(--text-muted); }

.btn, .btn-icon, .btn-delete {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 13px;
}
.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 9px 16px;
  font-weight: 600;
  box-shadow: 0 8px 20px var(--accent-soft);
}
.btn:hover { filter: brightness(1.08); }
.btn-icon {
  background: var(--accent-soft);
  color: var(--accent);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}
.btn-icon:hover { background: var(--accent); color: #fff; }
.btn-delete {
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 4px;
}
.btn-delete:hover { color: var(--danger); }

.links-list, .task-summary, .task-list { list-style: none; margin: 0; padding: 0; }
.links-list li, .task-summary li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 8px;
}
.links-list li:last-child, .task-summary li:last-child { border-bottom: none; }
.links-list .icon { margin-right: 6px; }
.links-list a { font-weight: 500; color: var(--text); }
.links-list a:hover { color: var(--accent); }
.task-summary .dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.task-summary .task-title { flex: 1; min-width: 0; }
.due { font-size: 11px; color: var(--text-muted); margin-left: 8px; background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; flex-shrink: 0; }
.empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.link-more { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; }

textarea#quick-note {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.inline-form.hidden { display: none; }
.inline-form input, .inline-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 10px;
  font-size: 13px;
}
.inline-form button {
  padding: 8px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

/* Projects / tasks page */
.project-block {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px var(--card-shadow);
  min-width: 0;
}
.project-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.project-header::before {
  content: '';
  width: 8px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  flex-shrink: 0;
}
.project-header h2 { flex: 1; font-size: 16px; margin: 0; font-weight: 600; min-width: 0; }

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  margin-top: 6px;
  font-size: 14px;
  background: var(--field-bg);
  flex-wrap: wrap;
}
.task-item:hover { background: var(--accent-soft); }
.task-item.status-done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-item .task-title { flex: 1; min-width: 120px; }
.priority {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  font-weight: 600;
}
.priority-low { background: rgba(16,185,129,0.15); color: var(--success); }
.priority-medium { background: rgba(217,119,6,0.15); color: var(--warning); }
.priority-high { background: rgba(220,38,38,0.15); color: var(--danger); }

/* Keep */
.keep-search {
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 999px;
  font-size: 13px;
  width: 240px;
  max-width: 100%;
}

.keep-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.keep-tabs a {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}
.keep-tabs a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

.keep-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 8px 0 10px;
}

.knote-composer {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 8px 32px var(--card-shadow);
  margin-bottom: 24px;
  max-width: 560px;
}
.composer-collapsed {
  padding: 14px 18px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 18px;
  transition: background 0.15s ease;
}
.composer-collapsed:hover { background: var(--accent-soft); }
.composer-collapsed-plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 6px 16px var(--accent-soft);
}
.composer-expanded { padding: 14px 18px; }
.composer-expanded.hidden { display: none; }
.composer-expanded input[type="text"]#composer-title {
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  width: 100%;
  margin-bottom: 8px;
  padding: 4px 0;
}
.composer-expanded textarea#composer-content {
  border: none;
  background: transparent;
  color: var(--text);
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  padding: 4px 0;
}
.composer-expanded input:focus, .composer-expanded textarea:focus { outline: none; }
.composer-items { margin: 8px 0; }
.composer-item-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.composer-item-row input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.composer-actions .spacer { flex: 1; }
.btn-text {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
}
.btn-text:hover { color: var(--text); }

.keep-grid {
  column-count: 3;
  column-gap: 16px;
}
@media (max-width: 1200px) { .keep-grid { column-count: 2; } }
@media (max-width: 700px) { .keep-grid { column-count: 1; } }

.knote {
  --knote-tint: 148,163,184;
  break-inside: avoid;
  width: 100%;
  display: inline-block;
  margin-bottom: 16px;
  background-color: var(--card-bg);
  background-image: linear-gradient(rgba(var(--knote-tint), 0.16), rgba(var(--knote-tint), 0.16));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px var(--card-shadow);
  position: relative;
}
.knote[data-color="default"] { background-image: none; }
.knote[data-color="yellow"] { --knote-tint: 251,191,36; }
.knote[data-color="green"] { --knote-tint: 52,211,153; }
.knote[data-color="teal"] { --knote-tint: 45,212,191; }
.knote[data-color="blue"] { --knote-tint: 96,165,250; }
.knote[data-color="purple"] { --knote-tint: 167,139,250; }
.knote[data-color="pink"] { --knote-tint: 244,114,182; }
.knote[data-color="red"] { --knote-tint: 248,113,113; }
.knote[data-color="orange"] { --knote-tint: 251,146,60; }
.knote[data-color="gray"] { --knote-tint: 148,163,184; }

.knote-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; min-height: 20px; }
.knote-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 8px;
  line-height: 1;
}
.knote-icon-btn:hover { background: var(--accent-soft); }
.knote-icon-btn.small { font-size: 12px; color: var(--text-muted); }

.knote-title {
  display: block;
  width: 100%;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  outline: none;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 2px 4px;
  margin-left: -4px;
  font-family: inherit;
}
.knote-title::placeholder { color: var(--text-muted); font-weight: 500; }
.knote-title:focus { background: var(--field-bg); }

.knote-content {
  display: block;
  width: 100%;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 20px;
  outline: none;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 2px 4px;
  margin-left: -4px;
  margin-bottom: 8px;
  resize: vertical;
}
.knote-content::placeholder { color: var(--text-muted); }
.knote-content:focus { background: var(--field-bg); }

.knote-items { list-style: none; margin: 0 0 6px; padding: 0; }
.knote-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.knote-item.is-checked .knote-item-text { text-decoration: line-through; color: var(--text-muted); }
.knote-item-text {
  flex: 1;
  min-width: 0;
  outline: none;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 14px;
}
.knote-item-text:focus { background: var(--field-bg); }

.knote-add-item input {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  width: 100%;
  padding: 4px;
}
.knote-add-item input:focus { outline: none; color: var(--text); }

.knote-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.knote-colors { display: flex; flex-wrap: wrap; gap: 5px; margin-right: auto; }
.knote-color-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.knote-color-dot.is-selected { border-color: var(--text); }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .app { flex-direction: column; }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .sidebar .brand { margin-bottom: 0; margin-right: 8px; flex-shrink: 0; }
  .sidebar a { padding: 8px 10px; flex-shrink: 0; }
  .theme-toggle-row { margin-top: 0; margin-left: 4px; flex-shrink: 0; }
  .sidebar-footer { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; border-top: none; padding-top: 0; flex-shrink: 0; }
  .content { margin-left: 0; padding: 20px; }
}

@media (max-width: 480px) {
  .theme-toggle-row span { display: none; }
  .content h1 { font-size: 21px; }
}

/* Dialog di conferma personalizzato */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 20px 50px var(--card-shadow);
  padding: 24px;
  width: 320px;
  max-width: 90%;
}
.confirm-box p { margin: 0 0 20px; font-size: 14px; color: var(--text); line-height: 1.4; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-actions button {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.confirm-cancel { background: var(--field-bg); color: var(--text); }
.confirm-cancel:hover { background: var(--border); }
.confirm-ok { background: var(--danger); color: #fff; }
.confirm-ok:hover { filter: brightness(1.1); }

/* Riscrittura AI */
.rewrite-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.rewrite-tabs a {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}
.rewrite-tabs a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}
.rewrite-intro {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 720px;
  margin: 0 0 22px;
  line-height: 1.5;
}

.rewrite-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}
.rewrite-panel {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: 0 8px 32px var(--card-shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rewrite-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.rewrite-counter { font-weight: 500; font-size: 12px; }
.rewrite-textarea {
  flex: 1;
  min-height: 320px;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.55;
}
.rewrite-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.rewrite-error {
  color: var(--danger);
  font-size: 12.5px;
  flex: 1;
}
.rewrite-actions .btn { flex-shrink: 0; white-space: nowrap; }
.rewrite-actions .btn:disabled { opacity: 0.7; cursor: default; }

.rewrite-result {
  flex: 1;
  min-height: 320px;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-y: auto;
}
.rewrite-placeholder { color: var(--text-muted); }

@media (max-width: 900px) {
  .rewrite-grid { grid-template-columns: 1fr; }
}

/* Cronologia riscritture */
.rewrite-history-list { display: flex; flex-direction: column; gap: 14px; }
.rewrite-history-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 8px 24px var(--card-shadow);
}
.rewrite-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.rewrite-history-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.rewrite-history-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.rewrite-history-text {
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}
@media (max-width: 700px) {
  .rewrite-history-cols { grid-template-columns: 1fr; }
}
