/* OficinaSync app shell — calm, dense and task-first. */
:root {
    color-scheme: dark;
    --bg-dark: #090a0d;
    --bg-card: #141519;
    --bg-elevated: #1a1b20;
    --border-glass: rgba(255, 255, 255, 0.075);
    --border-glass-hover: rgba(255, 255, 255, 0.14);
    --primary: #ff6b16;
    --primary-strong: #ff7a2f;
    --secondary: #5ac8fa;
    --accent: #30d158;
    --success: #30d158;
    --warning: #ffb340;
    --danger: #ff453a;
    --text-main: #f5f5f7;
    --text-muted: #a1a1aa;
    --text-inverse: #160b04;
    --radius: 14px;
    --radius-sm: 10px;
    --glass-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
    --font-body: 'Manrope', sans-serif;
    --font-display: 'Manrope', sans-serif;
    --transition-smooth: color 180ms ease, background-color 180ms ease,
        border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease,
        transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

html {
    background: var(--bg-dark);
    scroll-behavior: smooth;
}

body {
    background: var(--bg-dark);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle at 58% -20%, rgba(255, 107, 22, 0.055), transparent 34%);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    letter-spacing: -0.025em;
    text-wrap: balance;
}

p { font-size: 0.94rem; }

a {
    color: var(--secondary);
    text-underline-offset: 3px;
}

a:visited { color: #9dcbea; }

::selection {
    background: rgba(255, 107, 22, 0.32);
    color: #fff;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.17) transparent;
}

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.17);
    background-clip: padding-box;
}

/* Application frame */
.app-container {
    width: 100%;
    max-width: 1920px;
    min-height: 100dvh;
    gap: 14px;
    padding: 14px;
}

.app-header {
    position: sticky;
    top: 12px;
    min-height: 68px;
    padding: 9px 14px 9px 18px;
    border-color: rgba(255, 255, 255, 0.09);
    border-radius: 18px;
    background: rgba(20, 21, 25, 0.82);
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.app-header .logo img {
    max-height: 40px !important;
    filter: none !important;
}

.session-info { gap: 12px; }

.tenant-badge {
    min-height: 38px;
    padding: 7px 12px;
    border-color: rgba(255, 107, 22, 0.2);
    background: rgba(255, 107, 22, 0.09);
    font-size: 0.78rem;
}

.pulse-indicator {
    width: 7px;
    height: 7px;
    box-shadow: none;
}

.avatar {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 107, 22, 0.1);
}

.profile-info .username { font-size: 0.82rem; }
.profile-info .role { font-size: 0.68rem; }

.app-body-layout {
    grid-template-columns: 252px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
}

.app-sidebar {
    position: sticky;
    top: 94px;
    height: calc(100dvh - 108px);
    max-height: none;
    gap: 16px;
    overflow-y: auto;
    padding: 12px;
    border-color: rgba(255, 255, 255, 0.075);
    border-radius: 18px;
    background: rgba(20, 21, 25, 0.78);
    box-shadow: none;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.sidebar-nav { gap: 3px; }

.nav-section-title {
    margin: 5px 0 7px;
    padding-left: 10px;
    color: rgba(245, 245, 247, 0.46);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
}

.nav-item {
    position: relative;
    min-height: 44px;
    padding: 9px 11px;
    gap: 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #a9adb7;
    font-size: 0.79rem;
    line-height: 1.25;
}

.nav-item i {
    width: 20px;
    color: #777d89;
    font-size: 0.9rem;
    transition: color 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-item:hover {
    padding-left: 11px;
    border-color: rgba(255, 255, 255, 0.055);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-main);
}

.nav-item:hover i { color: #c5c7ce; transform: translateX(1px); }

.nav-item.active {
    border-color: rgba(255, 107, 22, 0.19);
    background: rgba(255, 107, 22, 0.105);
    color: #fff;
    font-weight: 650;
}

.nav-item.active i { color: var(--primary); }

.sidebar-footer {
    margin-top: auto;
    border-color: rgba(255, 255, 255, 0.06);
}

.app-main-content {
    min-width: 0;
    padding: 8px 4px 48px;
}

.tab-content {
    gap: 16px;
    animation: appPanelIn 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

.tab-header {
    margin: 0;
    padding: 2px 2px 5px;
}

.tab-header h2 {
    margin-bottom: 4px;
    font-size: clamp(1.62rem, 2vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.04em;
    line-height: 1.12;
}

.tab-header h3 { font-weight: 700; }
.tab-header p { max-width: 68ch; color: var(--text-muted); }

/* Surfaces and information hierarchy */
.dashboard-grid-layout,
.flex-column { gap: 14px; }

.grid-card,
.glass-card {
    border-color: rgba(255, 255, 255, 0.075);
    background: var(--bg-card);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.grid-card {
    padding: 20px;
    border-radius: 16px;
}

.grid-card:hover { border-color: rgba(255, 255, 255, 0.11); }

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

#tab-admin-dashboard .metrics-row-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-box,
.metric-box.grid-card {
    min-height: 128px;
    justify-content: center;
    gap: 7px;
    padding: 18px 19px;
    border-radius: 15px;
    background: #121318;
}

.metric-box .label {
    color: #858b98;
    font-size: 0.68rem;
    letter-spacing: 0.07em;
}

.metric-box .val {
    font-size: clamp(1.55rem, 2.25vw, 2rem);
    letter-spacing: -0.055em;
    line-height: 1.08;
    text-shadow: none;
}

.metric-box .sub { color: #8c919c; font-size: 0.72rem; }

.two-columns-grid { gap: 14px; }

.two-columns-grid > .grid-card {
    min-height: 300px;
    border-radius: 18px;
}

.grid-card h3 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.mechanic-row,
.simulator-box,
.metric-strip > span,
.executive-cards article,
.plan-compare-card {
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.028);
    box-shadow: none;
}

.simulator-box {
    border-radius: 13px;
    padding: 14px;
}

.chart-legend { color: #8d929d; }
.chart-bar { transition: transform 240ms ease, opacity 240ms ease, background-color 240ms ease; }
.chart-bar:hover { transform: translateY(-2px); }

/* Controls */
.btn {
    min-height: 44px;
    padding: 9px 15px;
    border-radius: 10px;
    font-size: 0.79rem;
    letter-spacing: -0.01em;
    transition: color 160ms ease, background-color 160ms ease,
        border-color 160ms ease, box-shadow 160ms ease,
        transform 100ms cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.975); }

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 8px 22px rgba(255, 107, 22, 0.14);
}

.btn-primary:hover {
    background: var(--primary-strong);
    box-shadow: 0 10px 26px rgba(255, 107, 22, 0.2);
}

.btn-secondary {
    border-color: rgba(255, 255, 255, 0.085);
    background: rgba(255, 255, 255, 0.045);
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.075);
}

.btn-small { min-height: 36px; padding: 7px 12px; border-radius: 9px; }

.btn-icon-only,
.close-btn,
.password-toggle-btn {
    width: 44px !important;
    min-width: 44px;
    height: 44px !important;
    min-height: 44px;
    border-radius: 11px;
}

.close-btn {
    display: grid;
    place-items: center;
    font-size: 1.25rem;
}

.close-btn:hover { background: rgba(255, 255, 255, 0.06); }

.btn:focus-visible,
.nav-item:focus-visible,
.sub-tab-btn:focus-visible,
.complex-tab:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(90, 200, 250, 0.58);
    outline-offset: 2px;
}

.form-group { gap: 7px; margin-bottom: 16px; }

.form-group label,
.complex-form label:not(.checkbox-label),
.complex-panel article > label {
    color: #a8acb6;
    font-size: 0.77rem;
    font-weight: 650;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-input-wrapper input,
.complex-panel input,
.complex-panel select,
.complex-panel textarea,
#support-modal input,
#support-modal select,
#support-modal textarea,
.unit-switcher select {
    min-height: 44px;
    border-color: rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.042);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.86rem;
}

.form-group textarea,
.complex-panel textarea,
#support-modal textarea { min-height: 104px; resize: vertical; }

.form-group input::placeholder,
.form-group textarea::placeholder,
.search-input-wrapper input::placeholder { color: #6f7480; opacity: 1; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-input-wrapper input:focus,
.complex-panel input:focus,
.complex-panel select:focus,
.complex-panel textarea:focus {
    border-color: rgba(90, 200, 250, 0.7) !important;
    box-shadow: 0 0 0 3px rgba(90, 200, 250, 0.13) !important;
}

/* Tabs, tables and statuses */
.sub-tabs-container {
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.sub-tab-btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 9px;
}

.sub-tab-btn.active {
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.075);
    color: #fff;
}

.table-responsive {
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 13px;
}

.glass-table { font-size: 0.81rem; }

.glass-table th,
.glass-table td { padding: 13px 15px; }

.glass-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #191a1f;
    color: #8f949f;
    font-family: var(--font-body);
    font-size: 0.66rem;
    letter-spacing: 0.07em;
}

.glass-table tbody tr { transition: background-color 140ms ease; }
.glass-table tbody tr:hover { background: rgba(255, 255, 255, 0.032); }

.status-pill,
.badge-stock,
.nav-badge {
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 25%, transparent);
    font-size: 0.63rem;
    letter-spacing: 0.035em;
}

.text-cyan,
.text-purple { text-shadow: none; }

/* Dialogs and temporary surfaces */
.modal {
    visibility: hidden;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: opacity 200ms ease, visibility 0s linear 200ms;
}

.modal.active {
    visibility: visible;
    transition-delay: 0s;
}

.modal-content {
    max-width: 520px;
    padding: 24px;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    background: #18191e;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.48);
    transform: translateY(16px) scale(0.985);
    transition: opacity 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal.active .modal-content { transform: translateY(0) scale(1); }

.modal-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-color: rgba(255, 255, 255, 0.075);
}

.close-btn {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    margin: -10px -10px -10px 0;
    border-radius: 11px;
    font-size: 1.15rem;
    transition: color 140ms ease, background-color 140ms ease;
}

.close-btn:hover { background: rgba(255, 255, 255, 0.055); }

.notification-panel {
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(24, 25, 30, 0.96);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

/* Login and registration */
.login-screen-overlay {
    overflow: auto;
    padding: 36px 20px;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 142, 76, 0.11), transparent 28%),
        #08090c;
}

.login-card {
    max-width: 470px;
    padding: 42px;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 26px;
    background: rgba(20, 21, 25, 0.9);
    box-shadow: 0 40px 110px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
}

.login-header { gap: 12px; margin-bottom: 28px; }

.login-header img {
    width: min(100%, 280px) !important;
    max-height: 78px !important;
    margin-bottom: 6px !important;
    object-fit: contain;
}

.login-card p {
    color: #a6abb5;
    font-size: 0.84rem;
    line-height: 1.55;
}

.login-card .form-group label { color: #c1c4cb; }

.login-card .form-group input {
    min-height: 48px;
    padding-inline: 14px;
    font-size: 0.93rem;
}

.login-card .btn-primary {
    min-height: 48px;
    font-size: 0.88rem;
}

.login-footer {
    margin-top: 22px;
    gap: 2px !important;
}

.login-footer a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: #73c9f4 !important;
    text-decoration: none;
}

.login-footer a:hover { text-decoration: underline; }

.register-progress-bar { height: 5px; background: rgba(255, 255, 255, 0.075); }
.register-step-icon { border-radius: 11px; }

/* Responsive workspace */
@media (max-width: 1180px) {
    .app-body-layout { grid-template-columns: 230px minmax(0, 1fr); }
    .session-info { gap: 8px; }
    .profile-info { display: none; }
}

@media (max-width: 1280px) {
    #tab-admin-dashboard .metrics-row-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .app-container { padding: 10px; gap: 10px; }

    .app-header { top: 8px; min-height: 62px; border-radius: 16px; }

    .app-sidebar {
        position: fixed;
        top: 0;
        width: min(88vw, 330px);
        height: 100dvh;
        padding: max(18px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
        border-radius: 0 22px 22px 0;
        background: rgba(20, 21, 25, 0.97);
        box-shadow: 22px 0 70px rgba(0, 0, 0, 0.48);
        backdrop-filter: blur(26px);
        -webkit-backdrop-filter: blur(26px);
    }

    .sidebar-backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); }
    .app-main-content { padding: 8px 2px 40px; }
}

@media (max-width: 760px) {
    .metrics-row-cards { grid-template-columns: 1fr; }
    #tab-admin-dashboard .metrics-row-cards { grid-template-columns: 1fr; }

    .metric-box,
    .metric-box.grid-card {
        min-height: 108px;
        padding: 16px;
    }

    .two-columns-grid { grid-template-columns: 1fr; }
    .two-columns-grid > .grid-card { min-height: auto; }
    .tab-header h2 { font-size: 1.6rem; }
    .grid-card { padding: 16px; border-radius: 14px; }
    .table-responsive { margin-inline: -1px; }
}

@media (max-width: 600px) {
    .app-header { padding: 8px 9px; }
    .session-info { margin-left: auto; }
    #header-plan-badge { display: none; }
    .notification-bell-wrap .btn-icon-only,
    .btn-support,
    #btn-logout,
    .mobile-menu-button { width: 44px !important; height: 44px !important; }
    .btn-support {
        flex: 0 0 44px;
        padding: 0;
        font-size: 0;
    }
    .btn-support i { font-size: 0.86rem; }
    .avatar { width: 40px; height: 40px; }
    .tab-content { gap: 13px; }
    .action-buttons-group { gap: 8px; }
    .action-buttons-group .btn { flex: 1 1 auto; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-input-wrapper { max-width: none; }
    .horizontal-form-grid { grid-template-columns: 1fr; }
    .btn-small { min-height: 44px; }
    input, select, textarea { font-size: 16px !important; }

    .modal {
        align-items: flex-start;
        padding: 12px;
    }

    .modal-content {
        width: 100%;
        max-height: calc(100dvh - 24px);
        padding: 20px;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-radius: 18px;
    }
}

@media (max-width: 520px) {
    .login-screen-overlay {
        align-items: center;
        padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
        background: #090a0d;
    }

    .login-card {
        width: 100%;
        padding: 28px 20px;
        border: 0 !important;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .register-card {
        padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
        background: var(--bg-dark);
    }

    .login-header img { width: min(100%, 250px) !important; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --border-glass: rgba(255, 255, 255, 0.2);
        --border-glass-hover: rgba(255, 255, 255, 0.34);
        --text-muted: #c9cbd1;
    }
}
