:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --ink: #111827;
    --muted: #667085;
    --soft: #f1f5f9;
    --line: #e6eaf0;
    --brand: #2563eb;
    --brand-strong: #1d4ed8;
    --success: #0f9f6e;
    --danger: #dc2626;
    --warning: #b7791f;
    --shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
}

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

a:hover {
    color: var(--brand-strong);
    text-decoration: none;
}

/* ===== LAYOUT PRINCIPAL ===== */
.app-shell {
    display: grid;
    grid-template-rows: 54px 1fr;
    grid-template-columns: 220px minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
}

/* Topbar global — ocupa toda a largura */
.app-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    z-index: 1000;
    position: relative;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 178px;
    flex-shrink: 0;
}

.app-header-brand strong,
.app-header-brand small {
    display: block;
}

.app-header-brand strong {
    font-size: 14px;
}

.app-header-brand small {
    color: var(--muted);
    font-size: 11px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
}

/* Sino de notificações */
.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    transition: background 0.15s;
}
.notification-bell:hover { background: var(--soft); }
.notification-bell .bell-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    background: #ef4444;
    color: #fff;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

/* Sidebar — coluna 1, linha 2 */
.sidebar {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 10px 10px 20px;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow-x: hidden;
}

.sidebar nav { flex: 1; }

/* Botão toggle — sempre no topo, alinhado à direita */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0 0 10px auto; /* empurra para a direita, fica no topo */
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--soft); color: var(--ink); }

/* ── Estado colapsado ── */
.app-shell { transition: grid-template-columns 0.2s ease; }

.app-shell.sidebar-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
}
.app-shell.sidebar-collapsed .nav-section-label {
    visibility: hidden;
    font-size: 0;
    margin: 8px 0 2px;
}
.app-shell.sidebar-collapsed .sidebar .uk-nav a {
    justify-content: center;
    padding: 8px 4px;
    gap: 0;
}
.app-shell.sidebar-collapsed .sidebar .nav-label {
    display: none;
}
/* Ícones maiores no modo colapsado */
.app-shell.sidebar-collapsed .sidebar .uk-nav a .uk-icon svg {
    width: 36px;
    height: 36px;
}
.app-shell.sidebar-collapsed .sidebar-toggle {
    margin: 0 auto 10px; /* centraliza o botão quando sidebar está estreita */
}

.nav-section-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    padding: 0 8px;
    margin: 16px 0 4px;
    display: block;
}

.nav-section-label:first-child {
    margin-top: 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 0 6px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 34px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 14px;
}

.brand small {
    color: var(--muted);
    font-size: 11px;
}

.sidebar .uk-nav {
    display: grid;
    gap: 4px;
}

.sidebar .uk-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    color: #475467;
    border-radius: 9px;
    padding: 7px 9px;
    font-weight: 600;
}

.sidebar .uk-nav a .uk-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar .uk-nav a .uk-icon {
    color: #98a2b3;
}

.sidebar .uk-active a {
    background: #eff6ff;
    color: var(--brand);
}

.sidebar .uk-active a .uk-icon {
    color: var(--brand);
}

.sidebar .uk-nav li:not(.uk-active) a:hover {
    background: var(--soft);
    color: var(--ink);
}

.sidebar .uk-nav li:not(.uk-active) a:hover .uk-icon {
    color: #475467;
}

/* Content — coluna 2, linha 2 */
.content {
    grid-column: 2;
    grid-row: 2;
    overflow-y: auto;
    width: 100%;
    padding: 20px 28px 34px;
    min-width: 0;
}

/* Barra de busca (agora no app-header) */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 380px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    padding: 0 10px;
    color: var(--muted);
}

.topbar-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 9px;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 9px;
    position: relative;
    transition: background 0.15s;
}

.user-menu-trigger:hover {
    background: var(--soft);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--brand);
    font-weight: 800;
}

.user-meta {
    display: grid;
    line-height: 1.15;
    text-align: right;
}

.user-meta strong {
    font-size: 12px;
    color: var(--ink);
}

.user-meta span {
    font-size: 11px;
    color: var(--muted);
}

.icon-link {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #475467;
}

.topbar { display: none; }
.eyebrow { display: none; }

h1,
h2 {
    margin: 0;
    color: var(--ink);
    letter-spacing: 0;
}

h1 {
    font-size: 23px;
    line-height: 1.2;
    font-weight: 760;
}

h2 {
    font-size: 15px;
    line-height: 1.3;
    font-weight: 720;
}

.top-actions,
.form-actions,
.row-actions,
.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uk-button {
    border-radius: 9px;
    text-transform: none;
    font-weight: 700;
    letter-spacing: 0;
    min-height: 34px;
    line-height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

.uk-button-primary {
    background: var(--brand);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.uk-button-primary:hover {
    background: var(--brand-strong);
}

.uk-button-default {
    background: #fff;
    border-color: var(--line);
    color: #344054;
}

.uk-button-danger {
    background: var(--danger);
}

.uk-input,
.uk-select,
.uk-textarea {
    border-color: var(--line);
    border-radius: 9px;
    color: var(--ink);
    font-size: 13px;
}

.uk-input:focus,
.uk-select:focus,
.uk-textarea:focus {
    border-color: var(--brand);
}

.uk-label {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: none;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.metric-card,
.panel,
.person-card,
.inventory-card,
.assistant-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.metric-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
}

.metric-card small,
td span,
.person-card span,
.inventory-card span,
.inventory-card p,
.detail-grid span {
    display: block;
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    line-height: 1.15;
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: #eff6ff;
    color: var(--brand);
}

.metric-card.success .metric-icon {
    background: #ecfdf3;
    color: var(--success);
}

.metric-card.danger .metric-icon {
    background: #fef2f2;
    color: var(--danger);
}

.metric-card.accent .metric-icon {
    background: #fffbeb;
    color: var(--warning);
}

.panel,
.assistant-box {
    padding: 16px;
    margin-bottom: 14px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.priority-panel {
    width: 100%;
}

.priority-panel .table-wrap {
    min-height: 300px;
}

.dashboard-support-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.report-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.report-hero p {
    margin: 4px 0 0;
    color: var(--muted);
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.mini-report-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.uk-table-small th,
.uk-table-small td {
    padding: 10px 12px;
}

.uk-table {
    margin-bottom: 0;
}

.uk-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.uk-table td {
    color: #344054;
    font-size: 13px;
}

.uk-table td strong {
    color: var(--ink);
}

.uk-table-divider > tr:not(:first-child),
.uk-table-divider > :not(:first-child) > tr,
.uk-table-divider > :first-child > tr:not(:first-child) {
    border-top-color: var(--line);
}

.status-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.status-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px 10px;
}

.status-list-inline {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.signal-list {
    display: grid;
    gap: 9px;
    padding-left: 0;
    list-style: none;
}

.signal-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: #344054;
}

.signal-list-compact {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.filter-bar {
    margin-bottom: 16px;
}

.filter-bar-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: nowrap;
}
.filter-bar-inline .uk-input,
.filter-bar-inline .uk-select {
    height: 38px;
    min-width: 0;
}
.filter-bar-inline .uk-input  { flex: 2; }
.filter-bar-inline .uk-select { flex: 1; }
.filter-bar-inline .uk-button { white-space: nowrap; flex-shrink: 0; }

.section-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.form-panel .uk-form-label {
    color: #475467;
    font-weight: 800;
    font-size: 11px;
    text-transform: none;
}

.row-actions form,
.card-actions form {
    margin: 0;
}

.uk-icon-button {
    background: #f8fafc;
    color: #475467;
    border: 1px solid var(--line);
    width: 30px;
    height: 30px;
}

.uk-icon-button:hover {
    background: #eff6ff;
    color: var(--brand);
}

.danger-action {
    color: var(--danger);
}

.clickable-row,
.clickable-card {
    cursor: pointer;
}

.clickable-row:hover,
.clickable-card:hover {
    background: #f8fbff;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.person-card,
.inventory-card {
    padding: 14px;
}

.person-card {
    display: grid;
    gap: 13px;
}

.person-card strong,
.inventory-card strong {
    color: var(--ink);
}

.person-card footer,
.inventory-card footer {
    display: flex;
    gap: 14px;
    color: var(--muted);
}

/* ── List page header ─────────────────────────────── */
.list-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.list-page-meta { display: flex; align-items: baseline; gap: 10px; }
.list-page-meta h2 { margin: 0; font-size: 20px; font-weight: 700; }
.list-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--soft);
    padding: 2px 8px;
    border-radius: 20px;
}
.list-page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-search { min-width: 200px; border-radius: 8px !important; }

/* ── Person avatar (initials circle) ─────────────── */
.person-avatar {
    width: 42px; height: 42px; flex: 0 0 42px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: grid;
    place-items: center;
    user-select: none;
}
.person-avatar::after { content: attr(data-initials); }
.person-avatar--sm {
    width: 34px; height: 34px; flex: 0 0 34px;
    font-size: 12px;
}

/* avatar colour variety based on first initial */
.person-avatar[data-initials^="A"], .person-avatar[data-initials^="B"] { background: #6366f1; }
.person-avatar[data-initials^="C"], .person-avatar[data-initials^="D"] { background: #0ea5e9; }
.person-avatar[data-initials^="E"], .person-avatar[data-initials^="F"] { background: #10b981; }
.person-avatar[data-initials^="G"], .person-avatar[data-initials^="H"] { background: #f59e0b; }
.person-avatar[data-initials^="I"], .person-avatar[data-initials^="J"] { background: #ef4444; }
.person-avatar[data-initials^="K"], .person-avatar[data-initials^="L"] { background: #8b5cf6; }
.person-avatar[data-initials^="M"], .person-avatar[data-initials^="N"] { background: #ec4899; }
.person-avatar[data-initials^="O"], .person-avatar[data-initials^="P"] { background: #14b8a6; }
.person-avatar[data-initials^="Q"], .person-avatar[data-initials^="R"] { background: #f97316; }
.person-avatar[data-initials^="S"], .person-avatar[data-initials^="T"] { background: #3b82f6; }
.person-avatar[data-initials^="U"], .person-avatar[data-initials^="V"] { background: #a855f7; }

/* ── Rich person card ─────────────────────────────── */
.person-card--rich { padding: 16px; gap: 12px; }

.person-card__top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}
.person-card__info { flex: 1; min-width: 0; }
.person-card__info strong { display: block; font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-card__city { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.person-card__badge { align-self: flex-start; white-space: nowrap; flex-shrink: 0; }

.person-card__skills { display: flex; flex-wrap: wrap; gap: 4px; }
.skill-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--soft);
    color: var(--muted);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.person-card__footer {
    display: flex;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    margin-top: 2px;
}
.person-card__stat { display: flex; align-items: center; gap: 4px; }
.stat-stars { color: #f59e0b; font-size: 12px; letter-spacing: -1px; }

/* ── Customer table enhancements ─────────────────── */
.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .list-table { margin: 0; }
.list-table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    padding-top: 12px;
    padding-bottom: 12px;
    background: var(--soft);
}
.list-table thead th:first-child { padding-left: 16px; }
.list-table tbody tr td:first-child { padding-left: 16px; }

.table-person-cell { display: flex; align-items: center; gap: 10px; }
.table-person-cell strong { display: block; font-size: 13px; }
.table-person-cell span { display: block; font-size: 12px; color: var(--muted); }

.segment-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 600;
    white-space: nowrap;
}

.os-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: var(--soft);
    color: var(--muted);
    padding: 0 6px;
}
.os-count-badge--active {
    background: #eff6ff;
    color: var(--brand);
}

.inventory-card {
    display: grid;
    gap: 8px;
}

.inventory-card strong {
    min-height: 42px;
}

.inventory-card b {
    font-size: 24px;
    color: var(--ink);
}

.inventory-card.needs-stock {
    border-color: #fecaca;
    background: #fffafa;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-grid div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px;
}

.detail-grid span {
    font-size: 11px;
    font-weight: 700;
}

.detail-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
}

.note-form {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.note-form .uk-button {
    justify-self: start;
}

.whatsapp-form {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.whatsapp-form .uk-button {
    justify-self: start;
}

.message-thread {
    display: grid;
    gap: 10px;
}

.message-bubble {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: #f8fafc;
}

.message-bubble.sent {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.message-bubble.failed {
    border-color: #fecaca;
    background: #fff7f7;
}

.message-bubble header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.message-bubble p {
    margin: 8px 0 0;
    color: var(--ink);
}

.message-bubble small,
.empty-state {
    color: var(--muted);
}

.bom-form {
    align-items: end;
    margin-bottom: 16px;
}

.form-submit-column {
    display: flex;
    align-items: end;
}

#map {
    height: calc(100vh - 220px);
    min-height: 420px;
    border-radius: 12px;
    overflow: hidden;
}

.map-panel {
    padding: 10px;
}

.map-legend {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 0 4px 10px;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.map-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.map-dot-order { background: #2563eb; }
.map-dot-tech  { background: #059669; }

.assistant-box h2 {
    margin-bottom: 8px;
}

.chat-line {
    max-width: 80%;
    padding: 13px 15px;
    border-radius: 14px;
    margin-top: 14px;
}

.chat-line.bot {
    background: #eff6ff;
    color: #1e3a8a;
}

.chat-line.user {
    background: var(--brand);
    color: #fff;
    margin-left: auto;
}

.uk-alert-success,
.uk-alert-warning,
.uk-alert-danger {
    border-radius: 12px;
}

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f3f6fb;
}

body.login-page .login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    padding: 30px;
}

body.login-page .login-card h1 {
    font-size: 26px;
    margin-bottom: 18px;
}

.login-brand {
    margin-bottom: 22px;
    padding: 0;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form .uk-form-label {
    display: block;
    margin-bottom: 6px;
    color: #475467;
    font-weight: 700;
}

.login-hint {
    color: var(--muted);
    font-size: 12px;
    margin: 18px 0 0;
    text-align: center;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.permission-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
}

.permission-option:hover {
    background: #f8fbff;
}

.permission-option small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

.permissions-actions {
    margin-top: 16px;
}

@media (max-width: 1180px) {
    .metric-grid,
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
    .sidebar { display: none; }
    .content { padding: 12px; }
    .metric-grid,
    .card-grid { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ── Lookup cards (Gestão de ativos) ─────────────────────────────────────── */
.lookup-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 2.5rem 1.5rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-align: center;
    color: var(--ink);
    text-decoration: none;
    transition: box-shadow .18s, border-color .18s, transform .15s;
    cursor: pointer;
}
.lookup-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 18px rgba(37,99,235,.12);
    transform: translateY(-2px);
    color: var(--brand);
    text-decoration: none;
}
.lookup-card strong {
    font-size: 1.15rem;
    font-weight: 700;
}
.lookup-card span:not([uk-icon]) {
    font-size: .92rem;
    font-weight: 600;
    color: var(--brand);
}
.lookup-card small {
    color: var(--muted);
    font-size: .8rem;
}


/* ── Management page ─────────────────────────────────────────────────────── */
.management-page {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.mgmt-section-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--line);
}

.mgmt-section-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.mgmt-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.mgmt-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    min-width: 220px;
    max-width: 320px;
    flex: 1 1 220px;
    position: relative;
    transition: box-shadow .18s, border-color .18s, transform .15s;
}

.mgmt-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 18px rgba(37,99,235,.12);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--ink);
}

.mgmt-card-icon {
    flex-shrink: 0;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-tint, #eff6ff);
    border-radius: 10px;
    color: var(--brand);
}
.mgmt-card-body { flex: 1; min-width: 0; }
.mgmt-card-body strong { display: block; font-size: .95rem; }
.mgmt-card-body span   { display: block; font-size: .78rem; color: var(--ink-muted); margin-top: 2px; }
.mgmt-card-count {
    font-size: 1.3rem; font-weight: 700;
    color: var(--brand); flex-shrink: 0;
}
.mgmt-section-header {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: 1rem;
    color: var(--ink-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
}
.mgmt-section-header h2 { font-size: .8rem; margin: 0; color: var(--ink-muted); }

/* ── Quick-select com botão + inline ─────────────────────────────────────── */
.quick-select-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.quick-select-wrap .uk-select { flex: 1; min-width: 0; }
.quick-add-btn {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border: 1.5px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--brand);
    font-size: 18px; line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.quick-add-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Modais rápidos (quick-modal) ─────────────────────────────────────────── */
.quick-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.quick-modal[hidden] { display: none; }
.quick-modal-box {
    background: var(--panel);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
}
.quick-modal-box h3 { margin: 0 0 16px; font-size: 1.05rem; }
.quick-modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ── PWA Download Box ─────────────────────────────────────────────────────── */
.pwa-download-box {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.pwa-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.pwa-qr img {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
    background: #fff;
}
.pwa-qr small { font-size: 11px; color: var(--ink-muted); }
.pwa-info { flex: 1; min-width: 240px; }
.pwa-info strong { display: block; font-size: 1.05rem; margin-bottom: 6px; }
.pwa-info p { font-size: .88rem; color: var(--ink-muted); margin-bottom: 12px; }
.pwa-url-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.pwa-url-box code { flex: 1; font-size: .82rem; color: var(--brand); word-break: break-all; }
.pwa-hint { font-size: .8rem; color: var(--ink-muted); margin-top: 12px; margin-bottom: 0; }

/* ── Order asset chips ────────────────────────────────────────────────── */
.order-asset-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #e0e7ff; color: #3730a3;
    border-radius: 20px; padding: 4px 10px 4px 12px;
    font-size: 13px; font-weight: 500;
}
.order-asset-remove {
    background: none; border: none; cursor: pointer;
    color: #6366f1; font-size: 16px; line-height: 1; padding: 0;
    font-weight: 700;
}
.order-asset-remove:hover { color: #c81e1e; }

/* ── Order Detail ─────────────────────────────────────────────────────── */
.od-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.od-card {
    background: var(--surface, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    padding: 16px;
}
.od-card-wide { grid-column: 1 / -1; }
.od-card-title {
    font-size: 13px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ink-muted, #6b7280);
    margin: 0 0 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.od-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.od-dl dt { color: var(--ink-muted, #6b7280); white-space: nowrap; }
.od-dl dd { margin: 0; font-weight: 500; word-break: break-word; }

/* Status colors */
.status-new         { background: #dbeafe; color: #1d4ed8; }
.status-scheduled   { background: #ede9fe; color: #6d28d9; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-completed   { background: #d1fae5; color: #065f46; }
.status-cancelled   { background: #fee2e2; color: #991b1b; }

/* Timeline */
.od-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.od-timeline::before {
    content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
    width: 2px; background: var(--border, #e5e7eb);
}
.od-timeline-item { display: flex; gap: 14px; padding: 10px 0; position: relative; }
.od-timeline-dot {
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand, #1a56db); border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--brand, #1a56db); margin-top: 2px;
    z-index: 1;
}
.od-timeline-item.ev-note .od-timeline-dot,
.od-timeline-item.ev-technician_note .od-timeline-dot { background: #7c3aed; box-shadow: 0 0 0 2px #7c3aed; }
.od-timeline-item.ev-completed .od-timeline-dot { background: #059669; box-shadow: 0 0 0 2px #059669; }
.od-timeline-item.ev-cancelled .od-timeline-dot  { background: #dc2626; box-shadow: 0 0 0 2px #dc2626; }
.od-timeline-body { flex: 1; min-width: 0; }
.od-timeline-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.od-timeline-header strong { font-size: 14px; }
.od-author { font-size: 13px; color: var(--ink-muted, #6b7280); }
.od-time { font-size: 12px; color: var(--ink-muted, #6b7280); margin-left: auto; }
.od-timeline-notes { margin: 4px 0 0; font-size: 13px; color: var(--ink, #111827); white-space: pre-line; }

/* ── Peças da OS ─────────────────────────────────────────────────────────── */
.parts-add-panel summary { list-style: none; }
.parts-add-panel summary::-webkit-details-marker { display: none; }

.parts-add-panel {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 4px;
}

.parts-add-form {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.parts-bom-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    text-align: left;
    transition: background .15s, border-color .15s;
}
.parts-bom-chip:hover { background: #dbeafe; border-color: #93c5fd; }
.parts-bom-chip strong { font-size: 12px; color: #1e40af; }
.parts-bom-chip span   { font-size: 11px; color: #6b7280; }

.parts-bom-chip__badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    margin-top: 2px;
}
.parts-bom-chip__badge--warn { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

/* ── Modal de visualização rápida de OS ─────────────────────────────── */
.order-preview-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.order-preview-box {
    background: var(--panel);
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    padding: 22px 24px;
    width: 100%; max-width: 440px;
    animation: op-in .15s ease;
}
@keyframes op-in { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:none } }
.order-preview-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.order-preview-grid { display: grid; gap: 8px; }
.op-row { display: flex; gap: 10px; font-size: 13px; }
.op-label { color: var(--muted); min-width: 80px; font-weight: 600; }
