/* ============================================================
   FAMERP RAMAIS — Design System
   Branco como fundo principal, verde institucional FAMERP
   ============================================================ */

:root {
    /* Cores Institucionais FAMERP */
    --green-50: #e8f5e9;
    --green-100: #c8e6c9;
    --green-200: #a5d6a7;
    --green-300: #81c784;
    --green-400: #66bb6a;
    --green-500: #4caf50;
    --green-600: #43a047;
    --green-700: #388e3c;
    --green-800: #2e7d32;
    --green-900: #1b5e20;

    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    --red-500: #ef5350;
    --red-600: #e53935;
    --red-700: #d32f2f;
    --amber-500: #ffc107;
    --blue-500: #2196f3;

    /* Semânticas */
    --bg-primary: #ffffff;
    --bg-secondary: var(--gray-50);
    --bg-accent: var(--green-50);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-500);
    --border-color: var(--gray-200);
    --border-focus: var(--green-600);
    --accent: var(--green-800);
    --accent-light: var(--green-100);
    --accent-hover: var(--green-900);

    /* Layout */
    --header-height: 68px;
    --max-width: 1200px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Sombras */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.08), 0 8px 10px rgba(0,0,0,0.04);

    /* Transições */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

a:hover {
    color: var(--accent-hover);
}

img { max-width: 100%; height: auto; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.header-logo {
    width: auto;
    height: 44px;
    object-fit: contain;
}

.header-titles {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--green-900);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--green-800);
    background: var(--green-50);
}

.nav-link.active {
    color: var(--green-900);
    background: var(--green-50);
    font-weight: 600;
}

.nav-link svg { flex-shrink: 0; }

.nav-admin {
    color: var(--green-800);
    border: 1.5px solid var(--green-200);
}

.nav-admin:hover {
    background: var(--green-800);
    color: #fff;
    border-color: var(--green-800);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.mobile-menu-toggle:hover {
    background: var(--gray-100);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.site-main {
    flex: 1;
    width: 100%;
}

.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* ============================================================
   HERO / SEARCH SECTION
   ============================================================ */
.hero-section {
    background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%);
    padding: 3rem 1.5rem 3.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--green-300), var(--green-500), var(--green-300));
}

.hero-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hero-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hero-icon svg { stroke: #fff; }

.hero-titles h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.hero-titles p {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-top: 0.15rem;
}

/* INSTITUIÇÃO TABS */
.inst-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.inst-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid rgba(255,255,255,0.3);
    background: transparent;
    color: rgba(255,255,255,0.85);
    transition: all var(--duration) var(--ease);
    text-decoration: none;
}

.inst-tab:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.inst-tab.active {
    background: #fff;
    color: var(--green-900);
    border-color: #fff;
}

/* FUNFARME THEME */
.hero-funfarme {
    background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 100%);
}

.hero-funfarme::after {
    background: linear-gradient(90deg, #7dd3fc, #0284c7, #7dd3fc);
}

.hero-funfarme .search-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.25);
}

.hero-funfarme .search-select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.25);
}

/* SEARCH BOX */
.search-box {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid rgba(255,255,255,0.15);
}

.search-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input-wrap svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    stroke: var(--gray-400);
    pointer-events: none;
    width: 20px;
    height: 20px;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.95);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: all var(--duration) var(--ease);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-input:focus {
    outline: none;
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.25);
    background: #fff;
}

.search-select {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.95);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 180px;
    transition: all var(--duration) var(--ease);
}

.search-select:focus {
    outline: none;
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.25);
}

.search-btn {
    padding: 0.875rem 1.5rem;
    background: #fff;
    color: var(--green-900);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--green-50);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.search-filters {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
}

.stats-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stats-count {
    font-weight: 600;
    color: var(--green-800);
}

.stats-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
}

.btn-print:hover {
    border-color: var(--green-300);
    color: var(--green-800);
    background: var(--green-50);
}

.btn-print svg {
    width: 16px;
    height: 16px;
}

/* ============================================================
   RESULTS TABLE
   ============================================================ */
.results-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem;
}

.results-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    background: var(--bg-primary);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table thead {
    background: var(--green-900);
    color: #fff;
}

.results-table thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.results-table thead th:first-child {
    border-radius: var(--radius-lg) 0 0 0;
}

.results-table thead th:last-child {
    border-radius: 0 var(--radius-lg) 0 0;
}

.results-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--duration) var(--ease);
}

.results-table tbody tr:hover {
    background: var(--green-50);
}

.results-table tbody tr:last-child {
    border-bottom: none;
}

.results-table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.ramal-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--green-900);
    background: var(--green-50);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    display: inline-block;
    letter-spacing: 0.02em;
}

.contato-name {
    font-weight: 500;
    color: var(--text-primary);
}

.dept-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    background: var(--gray-100);
    border-radius: 100px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.inst-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.inst-badge.famerp {
    background: var(--green-100);
    color: var(--green-900);
}

.inst-badge.funfarme {
    background: #e3f2fd;
    color: #1565c0;
}

.email-link {
    font-size: 0.825rem;
    color: var(--blue-500);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    stroke: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================================
   CARDS (Admin Dashboard)
   ============================================================ */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--duration) var(--ease);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--green-800);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ============================================================
   FORMS (Admin)
   ============================================================ */
.form-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    max-width: 720px;
}

.form-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--green-100);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: all var(--duration) var(--ease);
}

.form-control:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.15);
}

.form-control.is-invalid {
    border-color: var(--red-500);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green-600);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.validation-message {
    font-size: 0.78rem;
    color: var(--red-600);
    margin-top: 0.25rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    border: 1.5px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--green-800);
    color: #fff;
    border-color: var(--green-800);
}

.btn-primary:hover {
    background: var(--green-900);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--gray-50);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--bg-primary);
    color: var(--red-600);
    border-color: var(--red-500);
}

.btn-danger:hover {
    background: var(--red-600);
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================================
   ALERTS & MESSAGES
   ============================================================ */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideDown 300ms var(--ease);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: var(--green-50);
    border: 1px solid var(--green-200);
    color: var(--green-900);
}

.alert-error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: var(--red-700);
}

.alert-warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #f57f17;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 2rem;
}

.login-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header img {
    height: 80px;
    width: auto;
    object-fit: contain;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.login-ad-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--green-50);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--green-800);
    margin-top: 0.75rem;
    border: 1px solid var(--green-200);
}

.login-btn {
    width: 100%;
    padding: 0.875rem;
    margin-top: 0.5rem;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    animation: spin 0.8s linear infinite;
}

/* ============================================================
   MANUAL PAGE
   ============================================================ */
.manual-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.manual-page h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--green-900);
    margin-bottom: 0.5rem;
}

.manual-page .lead {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.manual-section {
    margin-bottom: 2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.manual-section-header {
    background: var(--green-50);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--green-100);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background var(--duration) var(--ease);
}

.manual-section-header:hover {
    background: var(--green-100);
}

.manual-section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--green-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.manual-section-header .chevron {
    transition: transform 300ms var(--ease);
    stroke: var(--green-600);
}

.manual-section-header.open .chevron {
    transform: rotate(180deg);
}

.manual-section-body {
    padding: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    display: none;
}

.manual-section-body.show {
    display: block;
}

.manual-section-body p {
    margin-bottom: 0.75rem;
}

.manual-section-body .code-block {
    font-family: 'JetBrains Mono', monospace;
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin: 0.5rem 0;
    color: var(--green-900);
    border-left: 3px solid var(--green-400);
}

.manual-section-body strong {
    color: var(--text-primary);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
.print-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.print-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--green-800);
}

.print-header img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.print-header-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green-900);
    line-height: 1.2;
}

.print-header-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

.print-header-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.print-table thead th {
    background: var(--green-800);
    color: #fff;
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.print-col-ramal { width: 80px; }

.print-table td {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.8rem;
}

.print-dept-row td {
    background: var(--green-50);
    padding: 0.4rem 0.6rem;
    border-bottom: 2px solid var(--green-200);
    border-top: none;
}

.print-dept-name {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--green-900);
}

.print-dept-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

.print-dept-count::before { content: "("; }
.print-dept-count::after { content: ")"; }

.print-footer {
    margin-top: 1.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-300);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

.print-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

/* ============================================================
   ADMIN LAYOUT CLASSES
   ============================================================ */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green-900);
    margin: 0;
}
.admin-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0;
}
.filter-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.filter-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-field {
    min-width: 180px;
}
.filter-field--grow {
    flex: 1;
    min-width: 200px;
}
.filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
}
.row-inactive {
    opacity: 0.55;
}
.stat-value--green { color: var(--green-600); }
.stat-value--red { color: var(--red-500); }
.stat-value--dark { color: var(--green-800); }
.stat-value--blue { color: var(--blue-500); }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.back-link:hover {
    color: var(--green-700);
}
.collapsible-summary {
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--green-900);
    padding: 0.75rem 0;
}

@media print {
    /* Oculta tudo que não é conteúdo */
    .no-print,
    .site-header,
    .site-footer,
    .print-actions,
    .hero-section,
    .stats-bar,
    .cta-section,
    .pagination,
    .back-to-top,
    .search-box,
    .inst-tabs {
        display: none !important;
    }

    /* Reset geral */
    body {
        font-size: 9pt;
        color: #000;
        background: #fff;
        margin: 0;
        padding: 0;
    }

    .site-main {
        padding: 0;
        margin: 0;
    }

    /* Cabeçalho de impressão gerado via CSS */
    .results-section::before {
        content: "Ramais FAMERP — Faculdade de Medicina de São José do Rio Preto";
        display: block;
        font-size: 13pt;
        font-weight: 700;
        text-align: center;
        padding: 0.5cm 0 0.3cm;
        border-bottom: 2px solid #000;
        margin-bottom: 0.4cm;
    }

    .results-section {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Tabela de resultados */
    .results-table-wrap {
        overflow: visible !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .results-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8.5pt;
    }

    .results-table thead {
        position: static;
    }

    .results-table th {
        background: #1b5e20 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 4pt 6pt;
        font-size: 8pt;
        text-transform: uppercase;
        letter-spacing: 0.3pt;
    }

    .results-table td {
        padding: 3pt 6pt;
        border-bottom: 0.5pt solid #ccc;
        font-size: 8.5pt;
    }

    .results-table tbody tr:nth-child(even) {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Ramal em negrito, sem background */
    .ramal-number {
        background: none !important;
        padding: 0 !important;
        font-weight: 700;
        font-family: 'JetBrains Mono', monospace;
        font-size: 9pt;
    }

    /* Badge do departamento sem background */
    .dept-badge {
        background: none !important;
        padding: 0 !important;
        font-size: 8pt;
        color: #333;
    }

    /* Badge de instituição */
    .inst-badge {
        background: none !important;
        border: 0.5pt solid #999;
        padding: 1pt 4pt !important;
        font-size: 7pt;
    }

    /* Contato */
    .contato-name {
        font-weight: 500;
    }

    /* E-mail link sem decoração */
    .email-link {
        color: #000 !important;
        text-decoration: none !important;
    }

    /* Colunas ocultas em mobile — mostrar na impressão */
    .col-setor,
    .col-email {
        display: table-cell !important;
    }

    /* Sem quebra dentro das linhas */
    .results-table tr {
        page-break-inside: avoid;
    }

    /* Quebra de página automática para tabelas longas */
    .results-table thead {
        display: table-header-group;
    }

    /* Rodapé de impressão */
    .results-section::after {
        content: "FAMERP — Av. Brigadeiro Faria Lima, 5416 — São José do Rio Preto/SP — (17) 3201-5700";
        display: block;
        text-align: center;
        font-size: 7pt;
        color: #666;
        margin-top: 0.5cm;
        padding-top: 0.3cm;
        border-top: 0.5pt solid #999;
    }

    /* Pagina de impressao dedicada */
    .print-page {
        max-width: 100%;
        padding: 0;
    }

    .print-header {
        border-bottom: 2px solid #000;
        margin-bottom: 0.4cm;
        padding-bottom: 0.3cm;
    }

    .print-header img {
        width: 36px;
        height: 36px;
    }

    .print-header-text h1 {
        font-size: 13pt;
        color: #000;
    }

    .print-header-sub {
        font-size: 8pt;
        color: #333;
    }

    .print-header-meta {
        font-size: 7pt;
        color: #666;
    }

    .print-table {
        font-size: 8pt;
    }

    .print-table thead th {
        background: #1b5e20 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 3pt 6pt;
        font-size: 7pt;
    }

    .print-table td {
        padding: 2pt 6pt;
        border-bottom: 0.5pt solid #ddd;
        font-size: 8pt;
    }

    .print-dept-row td {
        background: #e8f5e9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-bottom: 1pt solid #a5d6a7;
        padding: 3pt 6pt;
    }

    .print-dept-name {
        font-size: 8pt;
        color: #000;
    }

    .print-dept-count {
        font-size: 6.5pt;
        color: #666;
    }

    .print-dept-row {
        page-break-inside: avoid;
    }

    .print-table thead {
        display: table-header-group;
    }

    .print-footer {
        font-size: 6.5pt;
        color: #666;
        border-top: 0.5pt solid #999;
        margin-top: 0.3cm;
        padding-top: 0.2cm;
    }

    /* Configuracoes da pagina */
    @page {
        size: A4 portrait;
        margin: 1.5cm;
    }
}

/* ============================================================
   ADMIN TABLE ACTIONS
   ============================================================ */
.admin-actions {
    display: flex;
    gap: 0.35rem;
}

.admin-actions .btn-sm {
    padding: 0.3rem 0.6rem;
}

.badge-active {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-500);
}

.badge-inactive {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red-500);
}

/* Status Toggle */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-indicator.active { color: var(--green-700); }
.status-indicator.inactive { color: var(--red-600); }

/* ============================================================
   CTA: SOLICITAR ALTERAÇÃO
   ============================================================ */
.cta-section {
    padding: 2rem 1.5rem 0;
    max-width: 1200px;
    margin: 0 auto;
}

.cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: var(--green-50, #f0fdf4);
    border: 1px solid var(--green-200, #bbf7d0);
    border-radius: 12px;
    padding: 1.25rem 1.75rem;
}

.cta-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: var(--green-100, #dcfce7);
    border-radius: 10px;
    color: var(--green-700, #15803d);
}

.cta-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cta-text strong {
    color: var(--green-900, #14532d);
    font-size: 0.95rem;
}

.cta-text span {
    color: var(--text-secondary, #64748b);
    font-size: 0.85rem;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: var(--green-700, #15803d);
    color: #fff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
}

.cta-btn:hover {
    background: var(--green-800, #166534);
    color: white;
    transform: translateY(-1px);
}

.cta-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .cta-inner {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }

    .cta-content {
        flex-direction: column;
    }

    .cta-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   MODAL DE CONFIRMAÇÃO
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(10px);
    transition: transform 0.2s;
}

.modal-overlay.open .modal-box {
    transform: scale(1) translateY(0);
}

.modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fef2f2;
    color: var(--red-500, #ef4444);
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modal-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.modal-actions .btn {
    min-width: 110px;
}

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.pagination-btn:hover {
    background: var(--green-50, #f0fdf4);
    border-color: var(--green-300, #86efac);
    color: var(--green-800);
}

.pagination-btn.active {
    background: var(--green-700, #15803d);
    border-color: var(--green-700, #15803d);
    color: #fff;
    font-weight: 600;
}

.pagination-btn.active:hover {
    background: var(--green-800, #166534);
}

@media (max-width: 480px) {
    .pagination {
        justify-content: center;
        flex-direction: column;
    }
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: var(--green-800);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 300ms var(--ease);
    z-index: 50;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--green-900);
    transform: translateY(-2px);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 2.5rem 1.5rem 0;
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-800);
}

.footer-brand {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.footer-logo {
    width: auto;
    height: 40px;
    object-fit: contain;
    opacity: 0.85;
}

.footer-brand strong {
    color: #fff;
    font-size: 1rem;
    display: block;
}

.footer-brand span {
    font-size: 0.78rem;
    line-height: 1.4;
}

.footer-info p {
    font-size: 0.82rem;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--gray-400);
    font-size: 0.85rem;
    transition: color var(--duration) var(--ease);
}

.footer-links a:hover {
    color: var(--green-300);
}

.footer-admin-link {
    font-size: 0.78rem !important;
    opacity: 0.6;
}

.footer-bottom {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 0;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.footer-version {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-left: 0.25rem;
    opacity: 0.7;
    white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .header-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        padding: 0.5rem;
        flex-direction: column;
    }

    .header-nav.open {
        display: flex;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-sm);
    }

    .hero-section {
        padding: 2rem 1rem 2.5rem;
    }

    .hero-titles h1 {
        font-size: 1.35rem;
    }

    .search-row {
        flex-direction: column;
    }

    .search-select {
        min-width: unset;
    }

    .search-filters {
        flex-direction: column;
    }

    .inst-tabs {
        flex-wrap: wrap;
    }

    .stats-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-table {
        font-size: 0.82rem;
    }

    .results-table thead th,
    .results-table tbody td {
        padding: 0.6rem 0.5rem;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-subtitle {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-icon { display: none; }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .results-table .col-email,
    .results-table .col-setor,
    .results-table .col-local {
        display: none;
    }
}

/* ============================================================
   LOADING ANIMATION
   ============================================================ */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--green-100);
    border-top-color: var(--green-700);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   SCROLL FADE-IN ANIMATION
   ============================================================ */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    animation: fadeInUp 400ms var(--ease) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-table tbody tr {
    animation: fadeInUp 300ms var(--ease) forwards;
    opacity: 0;
}

.results-table tbody tr:nth-child(1) { animation-delay: 30ms; }
.results-table tbody tr:nth-child(2) { animation-delay: 60ms; }
.results-table tbody tr:nth-child(3) { animation-delay: 90ms; }
.results-table tbody tr:nth-child(4) { animation-delay: 120ms; }
.results-table tbody tr:nth-child(5) { animation-delay: 150ms; }
.results-table tbody tr:nth-child(6) { animation-delay: 180ms; }
.results-table tbody tr:nth-child(7) { animation-delay: 210ms; }
.results-table tbody tr:nth-child(8) { animation-delay: 240ms; }
.results-table tbody tr:nth-child(9) { animation-delay: 270ms; }
.results-table tbody tr:nth-child(10) { animation-delay: 300ms; }
.results-table tbody tr:nth-child(n+11) { animation-delay: 320ms; }

/* ============================================================
   TOGGLE SWITCH (Categorias de Ramais — admin)
   ============================================================ */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    line-height: 1;
    white-space: nowrap;
}

.toggle-switch.on {
    background: #f0faf4;
    color: var(--green-700);
    border-color: #a7d7b8;
}

.toggle-switch .toggle-knob {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
    flex-shrink: 0;
    transition: background 150ms ease;
}

.toggle-switch.on .toggle-knob {
    background: var(--green-600);
}

.toggle-switch:hover {
    filter: brightness(0.96);
}

.toggle-switch:focus-visible {
    outline: 2px solid var(--green-700);
    outline-offset: 2px;
}

/* ============================================================
   BULK ACTION BAR (admin — ativar/desativar ramais em lote)
   ============================================================ */
.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background: #f0faf4;
    border: 1px solid #a7d7b8;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--green-900);
}

.bulk-action-bar[hidden] {
    display: none;
}

.bulk-action-info strong {
    color: var(--green-700);
    font-weight: 600;
}

.bulk-action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: underline;
    padding: 0.25rem 0.5rem;
}

.btn-link:hover {
    color: var(--text-primary);
}

/* Checkbox da coluna de seleção da tabela admin */
.ramal-checkbox,
#selectAllRamais {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--green-600);
}
