/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:      #0d0d0d;
  --white:      #ffffff;
  --grey-50:    #f7f7f7;
  --grey-100:   #efefef;
  --grey-300:   #d1d1d1;
  --grey-500:   #8a8a8a;
  --grey-700:   #444444;
  --accent:     #c8a96e;      /* oro caldo Up Music */
  --accent-dark:#a88950;
  --green:      #2e7d52;
  --green-bg:   #eaf5ee;
  --red:        #b33030;
  --red-bg:     #fdeaea;
  --orange:     #b36000;
  --orange-bg:  #fff3e0;
  --blue:       #1a5fa8;
  --blue-bg:    #e8f0fb;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --transition: .18s ease;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--grey-50);
  color: var(--black);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: var(--black);
  border-bottom: 3px solid var(--accent);
  padding: 0 2rem;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
}

.logo { display: flex; align-items: center; gap: .6rem; }

.logo-mark {
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .01em;
}

.logo-sub {
  font-weight: 400;
  color: var(--grey-300);
  font-size: .9rem;
  margin-left: .4rem;
}

/* ── App body (sidebar + main) ── */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

body.has-sidebar { overflow: hidden; }
body.has-sidebar .app-body { height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0c0c0f 0%, #0f0f14 100%);
  border-right: 1px solid rgba(200,169,110,.1);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  padding: 1.6rem 1.3rem 1.3rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
  height: 30px;
  width: auto;
  display: block;
  filter: invert(1) hue-rotate(180deg);
}

.sidebar-section-label {
  display: block;
  padding: 1.1rem 1.5rem .4rem;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(200,169,110,.4);
}

.sidebar-nav {
  padding: 0 .7rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .72rem 1rem;
  border-radius: 10px;
  color: rgba(255,255,255,.42);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
  cursor: pointer;
}

.sidebar-item:hover {
  background: rgba(255,255,255,.065);
  color: rgba(255,255,255,.88);
}

.sidebar-item:active { transform: scale(.97); }

.sidebar-item--active {
  background: linear-gradient(135deg, #c8a96e 0%, #a88950 100%);
  color: #0c0c0f;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(200,169,110,.38), inset 0 1px 0 rgba(255,255,255,.18);
}

.sidebar-item--active:hover {
  background: linear-gradient(135deg, #d4b87c 0%, #b8995e 100%);
  color: #0c0c0f;
}

.sidebar-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: transform .2s;
}

.sidebar-item:not(.sidebar-item--active):hover .sidebar-icon {
  transform: scale(1.2);
}

.sidebar-spacer { flex: 1; min-height: 1rem; }

.sidebar-footer-area { padding: 0 .7rem .9rem; }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin-bottom: .7rem;
}

.sidebar-item--logout { color: rgba(255,100,100,.55); }
.sidebar-item--logout:hover {
  background: rgba(255,80,80,.08);
  color: rgba(255,120,120,.9);
}

/* ── Main ── */
main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

body.has-sidebar main {
  overflow-y: auto;
  height: 100vh;
}

/* ── Flash messages ── */
.flash-container { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }

.flash {
  padding: .85rem 1.2rem;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 500;
  border-left: 4px solid;
}
.flash--success { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.flash--error   { background: var(--red-bg);   color: var(--red);   border-color: var(--red);   }
.flash--info    { background: var(--blue-bg);   color: var(--blue);  border-color: var(--blue);  }

/* ── Page header ── */
.page-header { margin-bottom: 2rem; }

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: .35rem;
}

.page-subtitle { color: var(--grey-700); font-size: 1rem; line-height: 1.5; }

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--grey-100);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.1rem;
}

.card-hint { color: var(--grey-700); font-size: .88rem; margin-top: -.6rem; margin-bottom: 1.2rem; }

.required { color: var(--red); }
.optional { color: var(--grey-500); font-size: .85rem; font-weight: 400; }

/* ── Radio cards ── */
.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }

.radio-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.3rem;
  border: 2px solid var(--grey-300);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  flex: 1;
  min-width: 200px;
}

.radio-card:hover { border-color: var(--accent); background: var(--grey-50); }

.radio-card input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: #fdf9f2;
}

.radio-label { font-weight: 600; font-size: .97rem; color: var(--black); }

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition), background var(--transition);
  background: var(--grey-50);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: #fdf9f2;
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon { font-size: 2.8rem; margin-bottom: .6rem; }

.dropzone-text {
  font-size: 1rem;
  color: var(--grey-700);
  line-height: 1.6;
}

.dropzone-sub { font-size: .88rem; color: var(--grey-500); }

.dropzone-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--green);
}

.hint { color: var(--grey-500); font-size: .82rem; margin-top: .6rem; }

.hidden { display: none !important; }

/* ── Form fields ── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem 1.5rem;
}

.field-group { display: flex; flex-direction: column; gap: .35rem; }

.field-group--full { grid-column: 1 / -1; }

label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--grey-700);
}

.format-hint { font-weight: 400; color: var(--grey-500); font-size: .82rem; }

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--grey-300);
  border-radius: 7px;
  font-size: .97rem;
  font-family: inherit;
  color: var(--black);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 169, 110, .18);
}

.field--warning { border-color: var(--orange) !important; background: var(--orange-bg); }
.field--error   { border-color: var(--red)    !important; background: var(--red-bg);    }

.field-hint { font-size: .8rem; color: var(--grey-500); }
.field-hint.warn { color: var(--orange); font-weight: 500; }

textarea { resize: vertical; min-height: 80px; }

/* ── Review meta ── */
.review-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.badge {
  background: var(--black);
  color: var(--accent);
  padding: .3rem .85rem;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.meta-file { color: var(--grey-700); font-size: .9rem; }

/* ── Buttons ── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: .5rem;
}

.form-actions--review {
  justify-content: space-between;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.6rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:active { transform: scale(.98); }

.btn--primary {
  background: var(--accent);
  color: var(--black);
}

.btn--primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(200,169,110,.35);
}

.btn--ghost {
  background: transparent;
  color: var(--grey-700);
  border: 1.5px solid var(--grey-300);
}

.btn--ghost:hover { background: var(--grey-100); }

/* ── Fatture in Cloud status ── */
.fic-status {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  border: 1px solid;
}

.fic-status--connected {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green);
}

.fic-status--disconnected {
  background: var(--orange-bg);
  color: var(--orange);
  border-color: var(--orange);
}

.fic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.fic-btn {
  margin-left: auto;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.fic-btn:hover { text-decoration: underline; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--grey-500);
  font-size: .82rem;
  border-top: 1px solid var(--grey-100);
  background: var(--white);
}

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,13,13,.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 1rem;
}

.loading-overlay.hidden { display: none; }

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(200,169,110,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.loading-text { color: var(--white); font-size: 1.05rem; font-weight: 600; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 600px) {
  .field-grid { grid-template-columns: 1fr; }
  .radio-group { flex-direction: column; }
  .form-actions--review { flex-direction: column; gap: .75rem; width: 100%; }
  .btn { width: 100%; justify-content: center; }
}
