/* ========== Reset + Tokens ========== */
:root {
    /* paleta neutra (claro) */
    --bg: #f6f7f8;
    --surface: #ffffff;
    --ink: #111215;
    --muted: #6b7280;
    --border: #e3e5e8;

    /* neutros escuros */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* estados */
    --ok: #16a34a;
    --warn: #f59e0b;
    --err: #dc2626;
    --info: #2563eb;

    /* botões/realces */
    --accent: var(--gray-800);
    --accent-ink: var(--gray-900);

    /* tipografia */
    --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --fs-100: 12px;
    --fs-200: 13px;
    --fs-300: 14px;
    --fs-400: 15px;
    --fs-500: 16px;
    --fs-600: 18px;
    --fs-700: 20px;
    --fs-800: 24px;

    /* raios/sombra compactos */
    --radius: 8px;
    /* levemente arredondado */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .04);

    /* layout */
    --navbar-h: 56px;
    --sidebar-w: 260px;

    /* densidade compacta */
    --pad-1: 6px;
    --pad-2: 8px;
    --pad-3: 10px;
    --pad-4: 12px;
}

/* Tema escuro automático + manual por data-theme */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1114;
        --surface: #16191d;
        --ink: #f3f4f6;
        --muted: #9ca3af;
        --border: #252a31;
        --accent: #e5e7eb;
        --accent-ink: #111215;
        --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .25);
    }
}

:root[data-theme="light"] {
    --bg: #f6f7f8;
    --surface: #ffffff;
    --ink: #111215;
    --muted: #6b7280;
    --border: #e3e5e8;
    --accent: var(--gray-800);
    --accent-ink: var(--gray-900);
}

:root[data-theme="dark"] {
    --bg: #0f1114;
    --surface: #16191d;
    --ink: #f3f4f6;
    --muted: #9ca3af;
    --border: #252a31;
    --accent: #e5e7eb;
    --accent-ink: #111215;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 var(--fs-500)/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

/* ========== Layout (Navbar + Sidebar) ========== */

.app {
    display: grid;
    grid-template-rows: var(--navbar-h) auto;
    grid-template-columns: var(--sidebar-w) auto;
    grid-template-areas:
        "nav nav"
        "aside main";
    min-height: auto;
}

/* Navbar */
.navbar {
    grid-area: nav;
    height: var(--navbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 var(--pad-4);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--ink);
}

.navbar__brand-logo {
        width: 28px;
        height: 28px;
        background-image: url("../imagens/scartech.svg");
}

.navbar__spacer {
    flex: 1;
}

.navbar__actions {
    display: flex;
    gap: 8px;
}

/* Sidebar */
.sidebar {
    grid-area: aside;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: var(--pad-3);
    position: sticky;
    top: var(--navbar-h);
    align-self: start;
    height: calc(100vh - var(--navbar-h));
    overflow: auto;
}

.sidebar .menu {
    display: grid;
    gap: 2px;
}

.sidebar .menu a {
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--ink);
}

.sidebar .menu a:hover {
    background: var(--gray-100);
}

:root[data-theme="dark"] .sidebar .menu a:hover {
    background: #1d2127;
}

.sidebar .menu a.is-active {
    background: var(--gray-200);
    font-weight: 600;
}

/* Main */
.main {
    grid-area: main;
    padding: var(--pad-4);
}


/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    color: var(--muted);
    margin: 2px 0 var(--pad-3);
}

.bc__sep {
    opacity: .6;
}

.bc__item {
    color: var(--muted);
}

.bc__item--current {
    color: var(--ink);
    font-weight: 600;
}

/* ========== Cards, Títulos, Texto ========== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: var(--pad-4);
}

.h1 {
    font-size: var(--fs-800);
    font-weight: 700;
    letter-spacing: -.02em;
}

.h2 {
    font-size: var(--fs-700);
    font-weight: 650;
}

.h3 {
    font-size: var(--fs-600);
    font-weight: 600;
}

.text-muted {
    color: var(--muted);
}

/* ========== Forms (compactos) ========== */
label {
    display: block;
    font-weight: 600;
    margin: 6px 0 4px;
}

.input,
.select,
.textarea {
    width: 100%;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--gray-400);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0);
    /* foco discreto sem cor forte */
}

.form-row {
    display: grid;
    gap: 10px;
}

@media (min-width: 768px) {
    .form-row.cols-2 {
        grid-template-columns: 1fr 1fr;
    }

    .form-row.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== Botões contornados ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-400);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: transform .02s ease;
}

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

:root[data-theme="dark"] .btn:hover {
    background: #1d2127;
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    border-color: var(--accent);
    color: var(--accent-ink);
    background: transparent;
}

.btn.danger {
    border-color: var(--err);
    color: var(--err);
}

.btn.success {
    border-color: var(--ok);
    color: var(--ok);
}

.btn[disabled],
.btn.disabled {
    opacity: .5;
    pointer-events: none;
}
/* ========== Tabelas (design system) ========== */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-400);
}

/* Células */
.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

/* Cabeçalho */
.table thead th {
    background: var(--gray-100);
    font-weight: 700;
    font-size: 0.95rem;
}

:root[data-theme="dark"] .table thead th {
    background: #1d2127;
}

/* Zebra */
.table tbody tr:nth-child(odd) {
    background: rgba(0, 0, 0, 0.02);
}

:root[data-theme="dark"] .table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

/* Números */
.table td.is-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table.pdf {
    width: 100%;
    border-collapse: collapse;
    font-family: "DejaVu Sans", Arial, sans-serif;
    font-size: 9.5pt;
    color: #000;
}

.table.pdf thead th {
    font-size: 9pt;
    font-weight: 700;
    background: #f2f2f2;
    border-bottom: 1px solid #444;
    padding: 4px 6px;
    text-align: left;
}

.table.pdf tbody td {
    padding: 3px 6px;
    border-bottom: 0.5px solid #ddd;
    vertical-align: top;
    text-align: center;
    font-size: 8pt;
}

.table.pdf tbody tr:nth-child(even) {
    background: #fafafa;
}

.table.pdf .col-tipo {
    width: 10%;
    white-space: nowrap;
}

.table.pdf .col-desc {
    width: 50%;
}

.table.pdf .col-num {
    width: 13%;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table.pdf .col-qtd {
    width: 7%;
    text-align: center;
}

/* ========== Alerts ========== */
.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--surface);
}

.alert.success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.alert.error {
    border-color: #fecaca;
    background: #fee2e2;
    color: #7f1d1d;
}

.alert.warn {
    border-color: #fde68a;
    background: #fef9c3;
    color: #854d0e;
}

.alert.info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

:root[data-theme="dark"] .alert.success {
    background: #0f2214;
    color: #86efac;
}

:root[data-theme="dark"] .alert.error {
    background: #2a1010;
    color: #fecaca;
}

:root[data-theme="dark"] .alert.warn {
    background: #2a230a;
    color: #fde68a;
}

:root[data-theme="dark"] .alert.info {
    background: #0d1a2a;
    color: #bfdbfe;
}

/* ========== Skeletons ========== */
.skeleton {
    display: block;
    width: 100%;
    background: linear-gradient(90deg, rgba(0, 0, 0, .08), rgba(0, 0, 0, .05), rgba(0, 0, 0, .08));
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 6px;
    height: 12px;
}

@keyframes shimmer {
    0% {
        background-position: -150% 0
    }

    100% {
        background-position: 150% 0
    }
}

/* ========== Utilitárias (compactas) ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.mt-1 {
    margin-top: 6px
}

.mt-2 {
    margin-top: 10px
}

.mt-3 {
    margin-top: 16px
}

.mb-1 {
    margin-bottom: 6px
}

.mb-2 {
    margin-bottom: 10px
}

.mb-3 {
    margin-bottom: 16px
}

.p-1 {
    padding: 6px
}

.p-2 {
    padding: 8px
}

.p-3 {
    padding: 12px
}

.p-4 {
    padding: 16px
}

.grid {
    display: grid;
    gap: 10px;
}

.grid-2 {
    grid-template-columns: 1fr 1fr
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr)
}

.flex {
    display: flex
}

.items-center {
    align-items: center
}

.justify-between {
    justify-content: space-between
}

.gap-1 {
    gap: 6px
}

.gap-2 {
    gap: 10px
}

.hide {
    display: none !important
}

/* ===== Layout sem sidebar (páginas centradas) ===== */
.app.no-sidebar {
    grid-template-columns: 1fr;
    /* remove a coluna da sidebar */
    grid-template-areas:
        "nav"
        "main";
}

.app.no-sidebar .sidebar {
    display: none;
}

/* esconde sidebar */
.app.no-sidebar .main {
    display: flex;
    justify-content: center;
    /* centraliza horizontal */
    padding: var(--pad-4);
}

/* Caixa central (limita largura e dá respiro) */
.center-box {
    width: 100%;
    max-width: 860px;
    /* ajuste à sua preferência */
}

/* Opcional: estreitar um pouco para o cadastro/consulta */
.center-box--narrow {
    max-width: 720px;
}

/* Em telas muito pequenas mantém fluido */
@media (max-width: 480px) {

    .center-box,
    .center-box--narrow {
        max-width: 100%;
    }
}

/* ===== Inputs maiores em páginas centradas ===== */
.app.no-sidebar .center-box form .input,
.app.no-sidebar .center-box form .select,
.app.no-sidebar .center-box form .textarea {
    width: 100%;
    /* ocupa toda a largura disponível */
    font-size: 1rem;
    /* deixa o texto mais legível */
    padding: 10px 12px;
    /* mais respiro */
    margin-bottom: 12px;
    /* separação entre campos */
    box-sizing: border-box;
    /* respeita padding */
}

/* Distribuir campos lado a lado em telas médias/grandes */
.app.no-sidebar .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 colunas */
    gap: 16px;
}

@media (max-width: 768px) {
    .app.no-sidebar .form-grid {
        grid-template-columns: 1fr;
        /* empilha no mobile */
    }
}

/* Inputs maiores e distribuídos em telas de cliente */
.app.no-sidebar .center-box form .input,
.app.no-sidebar .center-box form .select,
.app.no-sidebar .center-box form .textarea {
  width: 100%;
  font-size: 1rem;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

/* Grid para distribuir os campos */
.app.no-sidebar .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;  /* duas colunas */
  gap: 20px;
}

@media (max-width: 768px) {
  .app.no-sidebar .form-grid {
    grid-template-columns: 1fr;   /* em telas pequenas empilha */
  }
}
/* Inputs, selects e textareas grandes nas páginas do cliente */
.app.no-sidebar .center-box form .input,
.app.no-sidebar .center-box form .select,
.app.no-sidebar .center-box form .textarea {
    width: 100%;
    font-size: 1rem;
    padding: 12px 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

/* Aparência uniforme dos selects */
.app.no-sidebar .center-box form .select {
    appearance: none;
    /* remove estilo nativo */
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='gray' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 12px center/12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
}

.card-menu {
    flex: 1 1 300px;
    /* ocupa pelo menos 300px e cresce */
    max-width: 350px;
    /* limite de largura */
    height: auto;
    /* altura automática */
    max-height: 250px;
    /* altura máxima */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    overflow: hidden;
    /* evita que conteúdo maior estoure */
}

.hide,
.hidden {
    display: none !important;
}

/* Fases do andamento */
.phases {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}
.phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 92px;           /* mesma largura para alinhar */
  gap: 6px;
  text-align: center;
}
.phase .bi {
  font-size: 28px;       /* tamanho do ícone */
  line-height: 1;
}
.phase__label {
  font-size: 12px;
  color: var(--muted);
}

/* Cores de estado */
.phase--done .bi    { color: var(--ok); }
.phase--todo .bi    { color: var(--gray-400); }   /* cinza */
.phase--done .phase__label { color: var(--ink); font-weight: 600; }

.pill { 
  display:inline-block; 
  padding:2px 8px; 
  border-radius:999px; 
  font-size:.82rem; 
  line-height:1.6;
  border:1px solid #ddd; 
}
.pill.ok { 
  background:#e7f6ec; 
  color:#1f6f3c; 
  border-color:#cfead7; 
  font-weight:600;
}
.pill.pending { 
  background:#fff3cd; 
  color:#7a5b00; 
  border-color:#ffe08a; 
  font-weight:600;
}



/* ========== Helpers ==========
   Alternar tema manual: document.documentElement.dataset.theme = 'light' | 'dark'
*/