:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e5e9f2;
    --border-strong: #d7deea;
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #16a34a;
    --warning: #d97706;
    --sidebar-bg: #0b1220;
    --sidebar-w: 268px;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 45px -22px rgba(15, 23, 42, 0.35);
    --shadow-lg: 0 30px 80px -24px rgba(15, 23, 42, 0.45);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

button {
    font-family: inherit;
}

a {
    color: var(--primary);
}

[hidden] {
    display: none !important;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

::selection {
    background: rgba(79, 70, 229, 0.2);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    font-family: inherit;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.btn .icon,
.btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 22px -12px rgba(79, 70, 229, 0.9);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-soft);
}

.btn-ghost:hover:not(:disabled) {
    border-color: #c7d2fe;
    color: var(--primary);
    background: #f8faff;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 10px 22px -12px rgba(220, 38, 38, 0.8);
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 12px 18px;
    font-size: 14.5px;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12.5px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.icon-btn.danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.icon-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.22);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-soft);
}

.form-hint {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--muted-2);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.textarea {
    resize: vertical;
    min-height: 96px;
}

.select {
    appearance: none;
    cursor: pointer;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.select-sm {
    width: auto;
    min-width: 168px;
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 13px;
}

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

.span-2 {
    grid-column: span 2;
}

.form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 18px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.form-divider::before,
.form-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 26px 0 14px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
}

.form-section-title:first-child {
    margin-top: 0;
}

.form-section-title .icon {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
}

.alert .icon {
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.alert-danger {
    background: var(--danger-soft);
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.login-page {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 100vh;
    background: var(--bg);
}

.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 52px 60px;
    color: #ffffff;
    background: linear-gradient(140deg, #0b1220 0%, #16203e 48%, #312e81 100%);
}

.hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

.hero-glow-1 {
    width: 380px;
    height: 380px;
    top: -90px;
    right: -80px;
    background: rgba(99, 102, 241, 0.5);
}

.hero-glow-2 {
    width: 420px;
    height: 420px;
    bottom: -140px;
    left: -100px;
    background: rgba(56, 189, 248, 0.22);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: auto 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    box-shadow: 0 12px 26px -12px rgba(79, 70, 229, 0.9);
}

.brand-mark svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-text {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-light {
    color: #ffffff;
}

.brand-light .brand-mark {
    background: linear-gradient(135deg, #818cf8, #4f46e5);
}

.login-hero .brand {
    margin-bottom: 48px;
}

.login-hero h1 {
    font-size: clamp(29px, 3.1vw, 44px);
    line-height: 1.14;
    letter-spacing: -0.025em;
    font-weight: 700;
    margin-bottom: 16px;
}

.hero-subtitle {
    max-width: 460px;
    font-size: 15.5px;
    line-height: 1.7;
    color: #c7d2fe;
}

.hero-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.hero-features li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 14px;
    color: #e2e8f0;
}

.feature-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(129, 140, 248, 0.45);
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.25);
    color: #c7d2fe;
    flex-shrink: 0;
}

.feature-check svg {
    width: 13px;
    height: 13px;
}

.hero-footer {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: #64748b;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: radial-gradient(circle at 80% 15%, #ffffff 0%, #f4f6fb 55%, #eef1f9 100%);
}

.login-card {
    width: 100%;
    max-width: 412px;
    padding: 36px;
    background: var(--surface);
    border: 1px solid #eaeef6;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.login-mobile-brand {
    display: none;
    justify-content: center;
    margin-bottom: 8px;
}

.login-header h2 {
    font-size: 25px;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.login-header p {
    margin-top: 7px;
    font-size: 13.5px;
    color: var(--muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 26px;
}

.login-form .alert {
    margin-top: 20px;
}

.login-form .btn-lg {
    margin-top: 4px;
}

.input-icon {
    position: relative;
}

.input-icon > .icon,
.input-icon > svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--muted-2);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.input-icon .input {
    padding-left: 40px;
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.password-toggle:hover {
    background: #f1f5f9;
}

.password-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-footer p {
    font-size: 12.5px;
    color: var(--muted);
}

.login-footer span {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--muted-2);
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    padding: 22px 16px 18px;
    color: #94a3b8;
    background: linear-gradient(180deg, #0b1220 0%, #0f172a 45%, #111c33 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    transition: transform 0.24s ease;
}

.sidebar-brand {
    padding: 6px 8px 22px;
}

.sidebar-brand .brand-mark {
    width: 40px;
    height: 40px;
}

.brand-text-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand .brand-text {
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-tagline {
    max-width: 160px;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: #64748b;
}

.sidebar-label {
    padding: 0 12px 10px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #475569;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-item .icon {
    width: 18px;
    height: 18px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(100deg, rgba(79, 70, 229, 0.95), rgba(99, 102, 241, 0.8));
    box-shadow: 0 12px 24px -16px rgba(79, 70, 229, 0.9);
}

.nav-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.6);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.profile-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 140, 248, 0.35);
}

.profile-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.55);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    text-transform: uppercase;
}

.profile-card-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-card-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    font-weight: 600;
    color: #ffffff;
}

.profile-card-meta small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: #64748b;
}

.profile-card-edit {
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: #64748b;
    opacity: 0.8;
}

.logout-form {
    margin-top: 8px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.logout-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

.logout-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.5);
}

.logout-btn .icon {
    width: 17px;
    height: 17px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.app-main {
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - 80px);
    overflow: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 32px;
    background: rgba(244, 246, 251, 0.86);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.page-heading h1 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-heading p {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
}

.mobile-menu {
    display: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.user-chip:hover {
    border-color: #c7d2fe;
    box-shadow: var(--shadow-sm);
}

.user-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.user-chip .avatar {
    width: 34px;
    height: 34px;
    font-size: 11.5px;
}

.user-chip-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 0;
}

.user-chip-meta strong {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip-meta small {
    font-size: 10.5px;
    color: var(--muted);
    line-height: 1.3;
}

.user-chip-chevron {
    width: 15px;
    height: 15px;
    color: var(--muted-2);
}

.content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px 32px;
}

.view {
    display: none;
    animation: fadeIn 0.28s ease;
}

.view.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-icon .icon {
    width: 21px;
    height: 21px;
}

.stat-indigo {
    background: #eef2ff;
    color: #4f46e5;
}

.stat-blue {
    background: #e0f2fe;
    color: #0284c7;
}

.stat-amber {
    background: #fef3c7;
    color: #b45309;
}

.stat-green {
    background: #dcfce7;
    color: #15803d;
}

.stat-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
}

.stat-value {
    margin-top: 2px;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

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

.card-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 22px 24px 26px;
}

.section-title h2 {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-title p {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.search-box {
    position: relative;
    width: 320px;
    max-width: 100%;
}

.search-box .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--muted-2);
    pointer-events: none;
}

.input-search {
    padding-left: 38px;
    padding-top: 9px;
    padding-bottom: 9px;
    background: var(--surface-2);
    border-color: var(--border);
}

.input-search:focus {
    background: var(--surface);
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.table-wrap {
    position: relative;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table thead th {
    padding: 11px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    font-size: 13.5px;
    color: var(--text-soft);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #f8faff;
}

.cell-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 260px;
}

.cell-title {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-sub {
    margin-top: 1px;
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.cell-inline .icon {
    width: 14px;
    height: 14px;
    color: var(--muted-2);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.notes-cell {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.status-select {
    appearance: none;
    padding: 5px 28px 5px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    transition: box-shadow 0.16s ease, opacity 0.16s ease;
}

.status-select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.status-select:disabled {
    opacity: 0.65;
    cursor: wait;
}

.st-novo {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.st-em_contato {
    background-color: #fef3c7;
    color: #b45309;
}

.st-qualificado {
    background-color: #ede9fe;
    color: #6d28d9;
}

.st-proposta {
    background-color: #e0e7ff;
    color: #4338ca;
}

.st-convertido {
    background-color: #dcfce7;
    color: #15803d;
}

.st-perdido {
    background-color: #fee2e2;
    color: #b91c1c;
}

.th-actions,
.td-actions {
    text-align: right !important;
    white-space: nowrap;
}

.td-actions .icon-btn {
    display: inline-flex;
    vertical-align: middle;
}

.data-table .td-actions {
    width: 96px;
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 20px;
    border-top: 1px solid var(--border);
    background: #fbfcfe;
    font-size: 12.5px;
    color: var(--muted);
}

.empty-state {
    padding: 52px 24px;
    text-align: center;
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
}

.empty-icon .icon {
    width: 26px;
    height: 26px;
}

.empty-state h3 {
    font-size: 15.5px;
    font-weight: 600;
}

.empty-state p {
    margin-top: 5px;
    font-size: 12.5px;
    color: var(--muted);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-cell .avatar {
    width: 34px;
    height: 34px;
    font-size: 11.5px;
}

.user-cell-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-cell-meta strong {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-cell-meta small {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.role-admin {
    background: #ede9fe;
    color: #6d28d9;
}

.role-user {
    background: #f1f5f9;
    color: #475569;
}

.self-tag {
    margin-left: 6px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 1px 6px;
    border-radius: 999px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease;
}

.modal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 660px;
    max-height: calc(100vh - 48px);
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.2s ease;
}

.modal-card.modal-sm {
    max-width: 440px;
}

.modal-card > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 48px);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-header p {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
}

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #fbfcfe;
    border-radius: 0 0 18px 18px;
}

body.modal-open {
    overflow: hidden;
}

.confirm-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 32px 20px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 14px;
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: #f5f7ff;
}

.dropzone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
}

.dropzone-icon .icon {
    width: 23px;
    height: 23px;
}

.dropzone-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}

.dropzone-hint {
    font-size: 12px;
    color: var(--muted);
}

.dropzone-file {
    margin-top: 6px;
    max-width: 100%;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-help {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.5;
}

.import-help strong {
    color: var(--text-soft);
    font-weight: 600;
}

.link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.link .icon {
    width: 15px;
    height: 15px;
}

.import-result {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    font-size: 13px;
    color: var(--text-soft);
}

.import-result.is-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.import-result.is-warning {
    border-color: #fde68a;
    background: #fffbeb;
}

.import-result.is-error {
    border-color: #fecaca;
    background: var(--danger-soft);
}

.import-result-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.import-result-head .icon {
    width: 18px;
    height: 18px;
}

.import-result.is-success .import-result-head {
    color: #166534;
}

.import-result.is-warning .import-result-head {
    color: #92400e;
}

.import-result.is-error .import-result-head {
    color: #b91c1c;
}

.import-result p {
    margin-top: 6px;
    line-height: 1.55;
}

.import-errors {
    max-height: 150px;
    margin: 10px 0 0;
    padding-left: 18px;
    overflow-y: auto;
    font-size: 12px;
    color: #92400e;
}

.import-errors li {
    margin: 3px 0;
}

.toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-soft);
    animation: toastIn 0.24s ease;
}

.toast .icon {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    min-width: 0;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.success .icon {
    color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.error .icon {
    color: var(--danger);
}

.toast.info {
    border-left-color: var(--primary);
}

.toast.info .icon {
    color: var(--primary);
}

.toast.hide {
    animation: toastOut 0.2s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

@media (max-width: 1200px) {
    .hide-lg {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .hide-md {
        display: none !important;
    }
}

@media (max-width: 980px) {
    .login-page {
        grid-template-columns: 1fr;
    }

    .login-hero {
        display: none;
    }

    .login-panel {
        min-height: 100vh;
        padding: 32px 20px;
    }

    .login-mobile-brand {
        display: inline-flex;
        width: 100%;
    }

    .login-card {
        margin: 0 auto;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .mobile-menu {
        display: inline-flex;
    }

    .content {
        padding: 22px 20px 44px;
    }

    .topbar {
        padding: 14px 20px;
    }
}

@media (max-width: 760px) {
    .hide-sm {
        display: none !important;
    }

    .user-chip-meta {
        display: none;
    }

    .user-chip {
        padding: 4px;
        border-radius: 50%;
    }

    .user-chip-chevron {
        display: none;
    }

    .search-box {
        width: 100%;
    }

    .filters {
        width: 100%;
    }

    .select-sm {
        flex: 1;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .btn {
        flex: 1;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 15px 16px;
    }

    .data-table {
        min-width: 0;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
    }

    .data-table tbody tr:last-child {
        border-bottom: none;
    }

    .data-table tbody tr:hover {
        background: transparent;
    }

    .data-table tbody td {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        width: auto;
        padding: 4px 0;
        border: none;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }

    .data-table tbody td:first-child {
        display: block !important;
        padding: 0 0 8px;
    }

    .data-table tbody td:first-child::before {
        display: none;
    }

    .data-table tbody td.td-actions {
        justify-content: flex-end;
        padding-top: 10px;
    }

    .data-table tbody td.td-actions::before {
        display: none;
    }

    .data-table .td-actions {
        width: auto;
    }

    .data-table .td-actions .icon-btn {
        border-color: var(--border);
        background: var(--surface);
    }

    .data-table .notes-cell {
        max-width: 62%;
        white-space: normal;
        text-align: right;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .data-table .cell-main {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .content {
        padding: 18px 14px 40px;
    }

    .topbar {
        padding: 12px 14px;
    }

    .page-heading h1 {
        font-size: 18px;
    }

    .page-heading p {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .card-toolbar {
        padding: 15px 16px;
    }

    .card-body {
        padding: 18px 16px 22px;
    }

    .modal {
        padding: 12px;
    }

    .modal-card,
    .modal-card > form {
        max-height: calc(100vh - 24px);
    }

    .modal-header {
        padding: 17px 18px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        padding: 14px 18px;
    }

    .login-panel {
        padding: 20px 14px;
    }

    .login-card {
        padding: 28px 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

    .stat-icon .icon {
        width: 18px;
        height: 18px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    .toast-container {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }
}

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