/* ─── TOKENS ─── */
:root {
  --bg:     #f8f9fa;
  --white:  #ffffff;
  --dark:   #111827;
  --text:   #6b7280;
  --border: #e5e7eb;
  --blue:   #0066ff;
  --font:   'Inter', Arial, sans-serif;
  --sidebar-w: 200px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--dark); -webkit-font-smoothing: antialiased; }

@keyframes nfFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── SHELL ─── */
.shell { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  height: 52px; padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.sidebar-nav { padding: 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 700; color: var(--text); opacity: .6;
  text-transform: uppercase; letter-spacing: .1em; padding: 10px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: default; text-decoration: none;
}
.nav-item:hover { background: var(--bg); color: var(--dark); }
.nav-item.active { background: var(--blue); color: #fff; }
.nav-item.active svg path,
.nav-item.active svg rect,
.nav-item.active svg circle,
.nav-item.active svg line,
.nav-item.active svg polyline { stroke: #fff; }
.nav-item svg { color: var(--blue); flex-shrink: 0; }
.nav-item.danger { color: #ef4444; }

/* ─── MAIN ─── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-hamburger { display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.topbar-hamburger span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; display: block; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.topbar-name { font-size: 13px; font-weight: 600; color: var(--dark); display: flex; align-items: center; gap: 4px; }

/* ─── CONTENT ─── */
.content { padding: 22px 28px; display: flex; flex-direction: column; gap: 16px; }

/* ─── PAGE HEADER ─── */
.appt-header {
  display: flex; align-items: center; justify-content: space-between;
  animation: nfFadeUp .4s ease both;
}
.appt-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; color: var(--dark);
}
.appt-header-actions { display: flex; align-items: center; gap: 10px; }
.appt-search {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--white); font-size: 13px; color: var(--text); cursor: default;
  min-width: 180px;
}
.appt-new-btn {
  padding: 8px 16px; background: var(--blue); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 700;
  font-family: var(--font); cursor: default; white-space: nowrap;
}

/* ─── TABLE ─── */
.appt-table-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  animation: nfFadeUp .4s .1s ease both;
}
.appt-table { width: 100%; border-collapse: collapse; }
.appt-table thead tr { border-bottom: 1px solid var(--border); }
.appt-table th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.appt-table td {
  padding: 12px 14px; font-size: 13px; color: var(--dark);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.appt-table tbody tr:last-child td { border-bottom: none; }
.appt-date { font-weight: 600; font-size: 13px; }
.appt-time { font-size: 11px; color: var(--text); margin-top: 2px; }
.appt-client { font-weight: 600; }
.appt-phone { font-size: 11px; color: var(--text); margin-top: 2px; }
.appt-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.appt-badge.confirmado { background: #dbeafe; color: #1d4ed8; }
.appt-badge.concluido  { background: #dcfce7; color: #15803d; }
.appt-badge.cancelado  { background: #fee2e2; color: #b91c1c; }
.appt-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.act-btn {
  padding: 4px 9px; border-radius: 6px;
  font-size: 10px; font-weight: 700; cursor: default; white-space: nowrap;
}
.act-btn.concluir  { background: #dcfce7; color: #15803d; }
.act-btn.cancelar  { background: #fee2e2; color: #b91c1c; }
.act-btn.emitir-nf { background: #dbeafe; color: #1d4ed8; }

/* ─── MODAL BACKDROP ─── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: nfFadeUp .3s ease both;
}
.modal {
  background: var(--white); border-radius: 16px;
  width: 440px; max-width: 90vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  animation: nfFadeUp .35s .05s ease both;
}

/* Modal header */
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 800; color: var(--dark); }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  cursor: default; color: var(--text);
}

/* Progress */
.modal-progress-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px 0;
}
.modal-step { font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; }
.modal-progress-bar {
  flex: 1; height: 3px; background: var(--border); border-radius: 10px; overflow: hidden;
}
.modal-progress-fill { width: 25%; height: 100%; background: var(--blue); border-radius: 10px; }

/* Modal body */
.modal-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 10px; }
.modal-section-title { font-size: 13px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }

/* NF items */
.nf-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--white);
}
.nf-item-info { flex: 1; min-width: 0; }
.nf-item-name { font-size: 13px; font-weight: 700; color: var(--dark); }
.nf-item-desc { font-size: 11px; color: var(--text); margin-top: 2px; }
.nf-item-price { font-size: 13px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.nf-gerar-btn {
  padding: 7px 14px; background: var(--blue); color: #fff;
  border: none; border-radius: 8px; font-size: 12px; font-weight: 700;
  font-family: var(--font); cursor: default; white-space: nowrap; flex-shrink: 0;
}

/* Manual fill */
.modal-manual { padding: 4px 22px 14px; }
.modal-manual-btn {
  width: 100%; padding: 10px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--white); font-size: 13px; font-weight: 600; color: var(--dark);
  font-family: var(--font); cursor: default;
}

/* Footer */
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}
.modal-cancel-btn {
  padding: 10px 20px; border: none; border-radius: 8px;
  background: var(--dark); color: #fff;
  font-size: 13px; font-weight: 700; font-family: var(--font); cursor: default;
}
.modal-submit-btn {
  padding: 10px 24px; border: none; border-radius: 8px;
  background: var(--blue); color: #fff;
  font-size: 13px; font-weight: 700; font-family: var(--font); cursor: default;
}
