/**
 * FCampo Manager — design system (enterprise / sobrio)
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #f1f3f5;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #1e293b;
    --accent-hover: #0f172a;
    --accent-soft: #f1f5f9;
    --brand: #1f5c45;
    --brand-hover: #174a38;
    --brand-soft: #e8f3ee;
    --brand-muted: #3d7a5a;
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --success-border: #bbf7d0;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --danger-border: #fecaca;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --warning-border: #fde68a;
    --info-bg: #f8fafc;
    --info-text: #334155;
    --info-border: #e2e8f0;
    --sidebar-bg: #0f172a;
    --sidebar-border: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --radius: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.panel table thead {
    background: var(--surface-muted);
}

.panel table th {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.panel table td {
    color: var(--text-secondary);
}

.panel table tbody tr:hover {
    background: #fafbfc;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.btn-danger {
    background: var(--danger-text);
    color: #fff;
    border-color: var(--danger-text);
}

.btn-danger:hover {
    background: #7f1d1d;
    border-color: #7f1d1d;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--accent-soft);
    color: var(--text);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.badge-outline {
    background: transparent;
    text-transform: none;
    font-weight: 500;
}

/* Forms */
.field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.field-input,
.field-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus,
.field-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.08);
}

.field-input:disabled {
    background: var(--surface-muted);
    color: var(--text-muted);
}

/* Navigation — sidebar escura, alto contraste */
.app-sidebar {
    background: #0f172a;
    background: var(--sidebar-bg);
    border-color: var(--sidebar-border);
    color: var(--sidebar-text);
}

.app-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5625rem 0.75rem;
    margin-bottom: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-text);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar.sidebar-collapsed .nav-label,
.app-sidebar.sidebar-collapsed .nav-section,
.app-sidebar.sidebar-collapsed .nav-section-divider,
.app-sidebar.sidebar-collapsed .context-banner,
.app-sidebar.sidebar-collapsed .sidebar-brand {
    display: none;
}

.app-sidebar.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.app-sidebar.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.625rem 0.5rem;
}

.app-sidebar.sidebar-collapsed .nav-section-divider {
    margin: 0.5rem 0.75rem;
}

.app-sidebar .nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.app-sidebar .nav-item-active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--brand-muted);
    font-weight: 600;
}

.app-sidebar .nav-section {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sidebar-text-muted);
    padding: 0.75rem 0.75rem 0.375rem;
}

.app-sidebar .sidebar-brand {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

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

.app-sidebar .sidebar-toggle:hover {
    color: var(--sidebar-text-active);
}

/* legado — mantém compatibilidade se alguma tela usar só .nav-item */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    margin-bottom: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-text);
    border-radius: var(--radius);
    text-decoration: none;
}

.nav-item-active {
    color: var(--sidebar-text-active);
}

/* Context banner (empresa) */
.context-banner {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.03);
}

.context-banner-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sidebar-text-muted);
}

.context-banner-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #f3f4f6;
    margin-top: 0.125rem;
}

/* Stats */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-card-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat-card-link {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.stat-card-link:hover {
    color: var(--brand);
    text-decoration: underline;
}

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 0.875rem;
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

.flash-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.flash-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.flash-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
}

/* Actions in tables */
.action-icon,
a.action-icon,
button.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-left: 0.125rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.action-icon:first-child {
    margin-left: 0;
}

.action-icon-svg {
    width: 1.125rem;
    height: 1.125rem;
}

.action-icon:hover {
    background: var(--surface-muted);
    color: var(--text);
    border-color: var(--border);
}

.action-icon-danger:hover {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

/* legado — links textuais fora de tabelas */
.action-link,
button.action-link {
    display: inline;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 0.75rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.action-link:first-child {
    margin-left: 0;
}

.action-link:hover {
    color: var(--text);
    text-decoration: underline;
}

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

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.table-actions .btn {
    margin-right: 0.75rem;
    vertical-align: middle;
}

.table-actions .btn + .action-icon,
.table-actions .btn + .action-link {
    margin-left: 0.25rem;
}

/* Modals */
.modal-backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.modal-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 24rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.login-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Notice boxes */
.notice {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface-muted);
}

.notice-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.notice-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

/* Section titles */
.section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.section-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Quick links grid */
.quick-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.quick-link:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}

.quick-link-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Toolbar */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Avatar */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius);
}

.avatar-lg {
    width: 5rem;
    height: 5rem;
    border-radius: var(--radius-lg);
    font-size: 1.5rem;
}

/* Configuração de Frentes */
.fc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--brand-soft) 0%, #f0f7f4 100%);
    border: 1px solid #c5ddd2;
    border-left: 4px solid var(--brand);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.fc-toolbar-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--brand-hover);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fc-toolbar-select {
    min-width: 18rem;
    flex: 1;
    max-width: 28rem;
}

.fc-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.fc-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.fc-section-header .section-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fc-section-body {
    padding: 1.25rem;
    background: var(--surface-muted);
}

.fc-section--equip .fc-section-header {
    background: linear-gradient(180deg, #eef6f1 0%, #f8fbf9 100%);
    border-bottom-color: #c5ddd2;
}

.fc-section--equip .fc-section-header .section-title {
    color: #134e36;
}

.fc-section--noteiros .fc-section-header {
    background: linear-gradient(180deg, #fff8eb 0%, #fffdf7 100%);
    border-bottom-color: #fde68a;
}

.fc-section--noteiros .fc-section-header .section-title {
    color: #92400e;
}

.fc-equip-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fc-equip-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.fc-equip-card--colhedora {
    border-left: 4px solid #2d6a4f;
}

.fc-equip-card--transbordo {
    border-left: 4px solid #b45309;
}

.fc-equip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.fc-equip-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.fc-badge-tipo {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.fc-badge-tipo--colhedora {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.fc-badge-tipo--transbordo {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.fc-operadores {
    padding: 1rem;
    background: #f1f5f9;
    border-top: 1px dashed var(--border-strong);
}

.fc-operadores-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.fc-operadores-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.fc-operadores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.5rem;
}

.fc-operador-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.fc-operador-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-noteiros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.75rem;
}

.fc-noteiro-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--surface);
    border: 1px solid #fde68a;
    border-left: 3px solid #d97706;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.fc-noteiro-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.fc-noteiro-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.fc-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.fc-empty-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.fc-empty-hint {
    font-size: 0.8125rem;
}

.fc-placeholder {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.fc-placeholder-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    border: 1px solid #c5ddd2;
    border-radius: 9999px;
    color: var(--brand);
}

.fc-placeholder-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.fc-placeholder-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}
