/* ==========================================================================
   Seabery Partners Area - Design System
   Custom CSS, no frameworks.
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy:        #1a2340;
    --navy-light:  #243054;
    --navy-dark:   #111827;
    --blue:        #2563eb;
    --blue-light:  #3b82f6;
    --blue-bg:     #eff6ff;
    --green:       #16a34a;
    --green-bg:    #f0fdf4;
    --orange:      #ea580c;
    --orange-bg:   #fff7ed;
    --red:         #dc2626;
    --red-bg:      #fef2f2;
    --gray-50:     #f9fafb;
    --gray-100:    #f3f4f6;
    --gray-200:    #e5e7eb;
    --gray-300:    #d1d5db;
    --gray-400:    #9ca3af;
    --gray-500:    #6b7280;
    --gray-600:    #4b5563;
    --gray-700:    #374151;
    --gray-800:    #1f2937;
    --white:       #ffffff;
    --shadow-sm:   0 1px 2px rgba(0,0,0,.05);
    --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:   0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius:      8px;
    --radius-lg:   12px;
    --sidebar-w:   260px;
    --topbar-h:    60px;
    --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .25s ease;
}

.sidebar-header {
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--navy-light);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .5px;
}

.logo-icon {
    width: 36px; height: 36px;
    background: var(--blue);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--navy-light);
}

.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: .75rem;
    opacity: .65;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav li a,
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.55);
    font-size: .9rem;
    transition: background .15s, color .15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-link:hover {
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.9);
    text-decoration: none;
}

.sidebar-nav li a.active {
    background: rgba(37, 99, 235, .15);
    color: #ffffff;
    border-left: 3px solid var(--blue);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: .6;
    transition: opacity .15s;
}

.sidebar-nav li a:hover .nav-icon,
.sidebar-nav li a.active .nav-icon {
    opacity: 1;
}

/* Disabled nav items (coming soon) */
.sidebar-nav li a.nav-disabled {
    opacity: .4;
    cursor: default;
    position: relative;
}
.sidebar-nav li a.nav-disabled:hover {
    background: transparent;
    opacity: .55;
}
.nav-soon-tag {
    font-size: .6rem;
    background: rgba(255,255,255,.15);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: auto;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.sidebar-nav li a.nav-bumped {
    opacity: .7;
    background: var(--navy-light);
    transition: opacity .3s, background .3s;
}

.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid var(--navy-light);
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--gray-600);
}

.topbar-center { display: flex; flex-direction: column; justify-content: center; }

.page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.2;
}

.breadcrumbs {
    font-size: .75rem;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 1px;
}

.breadcrumbs a {
    color: var(--gray-400);
    text-decoration: none;
}

.breadcrumbs a:hover { color: var(--blue); text-decoration: underline; }

.breadcrumbs .sep { margin: 0 6px; }

.breadcrumbs .current { color: var(--gray-600); font-weight: 500; }

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.env-badge {
    font-size: .7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--orange-bg);
    color: var(--orange);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.content {
    padding: 24px;
}

/* --- Flash Messages --- */
.flash-messages { padding: 16px 24px 0; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: .9rem;
    font-weight: 500;
}
.flash-error   { background: var(--red-bg);    color: var(--red); }
.flash-success { background: var(--green-bg);  color: var(--green); }
.flash-info    { background: var(--blue-bg);   color: var(--blue); }
.flash-warning { background: var(--orange-bg); color: var(--orange); }

/* --- Cards --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.card-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.1;
}

.card-subtitle {
    font-size: .85rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.card-icon.blue   { background: var(--blue-bg);   color: var(--blue); }
.card-icon.green  { background: var(--green-bg);  color: var(--green); }
.card-icon.orange { background: var(--orange-bg); color: var(--orange); }
.card-icon.navy   { background: #eef2ff;          color: var(--navy); }

/* --- Tables --- */
.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-size: 1rem;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 24px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

td {
    padding: 14px 24px;
    font-size: .9rem;
    border-bottom: 1px solid var(--gray-100);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* --- Badges / Status --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-active  { background: var(--green-bg); color: var(--green); }
.badge-pending { background: var(--orange-bg); color: var(--orange); }
.badge-expired { background: var(--red-bg); color: var(--red); }
.badge-info    { background: var(--blue-bg); color: var(--blue); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}
.btn-primary:hover { background: var(--blue-light); box-shadow: var(--shadow-md); }

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); }

.btn-danger {
    background: var(--red);
    color: var(--white);
}

.btn-sm { padding: 6px 14px; font-size: .8rem; }

/* --- Section --- */
.section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-800);
}

/* --- Welcome hero --- */
.welcome-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

.welcome-hero h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome-hero p {
    opacity: .8;
    font-size: .95rem;
}

/* ==========================================================================
   Login Page
   ========================================================================== */
.login-page {
    display: flex;
    min-height: 100vh;
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a6e 50%, #1a2340 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    color: white;
    padding: 60px 80px;
    position: relative;
    overflow: hidden;
}

.login-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.login-hero p {
    font-size: 1.1rem;
    opacity: .8;
    max-width: 400px;
    text-align: center;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--white);
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.login-box .subtitle {
    color: var(--gray-500);
    margin-bottom: 28px;
    font-size: .95rem;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: var(--font);
    transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

.demo-users {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.demo-users h3 {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
}

.demo-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 8px;
    font-family: var(--font);
    font-size: .9rem;
    text-align: left;
}

.demo-user-btn:hover { background: var(--blue-bg); border-color: var(--blue-light); }

.demo-user-btn .avatar {
    width: 32px; height: 32px;
    font-size: .7rem;
}

.demo-user-btn .info { display: flex; flex-direction: column; }
.demo-user-btn .info strong { font-size: .85rem; color: var(--gray-800); }
.demo-user-btn .info span { font-size: .75rem; color: var(--gray-500); }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 460px;
    overflow: hidden;
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
}
.modal-close:hover { color: var(--gray-800); }

.modal-body { padding: 20px 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- Toast --- */
.proposal-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 440px;
    font-size: .9rem;
    line-height: 1.5;
}

.toast-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green);
}

.toast-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
}

.toast-link {
    font-weight: 600;
    text-decoration: underline;
}

/* ==========================================================================
   Kanban Pipeline
   ========================================================================== */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 400px;
}

.kanban-column {
    min-width: 260px;
    max-width: 300px;
    flex: 1;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}

.kanban-column-closed { min-width: 180px; max-width: 200px; flex: 0; }

.kanban-column-header {
    padding: 14px 16px;
    border-bottom: 2px solid var(--blue);
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kanban-column-title {
    font-size: .85rem;
    font-weight: 700;
    color: var(--gray-800);
}

.kanban-column-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

.kanban-count {
    font-size: .75rem;
    font-weight: 700;
    background: var(--blue-bg);
    color: var(--blue);
    padding: 1px 8px;
    border-radius: 10px;
}

.kanban-value {
    font-size: .75rem;
    font-weight: 600;
    color: var(--gray-500);
}

.kanban-cards {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    max-height: 65vh;
}

.kanban-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--blue);
    transition: box-shadow .15s, transform .15s;
    position: relative;
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800);
    text-decoration: none;
    display: block;
    margin-bottom: 6px;
    line-height: 1.3;
}

.kanban-card-title:hover { color: var(--blue); text-decoration: none; }

.kanban-card-account {
    font-size: .75rem;
    color: var(--gray-500);
    margin-bottom: 8px;
    line-height: 1.3;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.kanban-card-value {
    font-size: .8rem;
    font-weight: 700;
    color: var(--navy);
}

.kanban-card-actions {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    gap: 4px;
}

.kanban-card:hover .kanban-card-actions { display: flex; }

.btn-stage-move {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--gray-300);
    background: var(--white);
    cursor: pointer;
    font-size: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: background .15s;
}

.btn-stage-move:hover { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }

.kanban-empty {
    text-align: center;
    color: var(--gray-300);
    font-size: .8rem;
    padding: 24px 12px;
}

@media (max-width: 768px) {
    .kanban-board { flex-direction: column; }
    .kanban-column { min-width: 100%; max-width: 100%; }
    .kanban-cards { max-height: none; }
}

/* ==========================================================================
   Simulators / 3D Viewer
   ========================================================================== */

/* Layout: sidebar catalog + viewer */
.sim-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    min-height: calc(100vh - var(--topbar-h) - 48px);
}

/* Catalog sidebar */
.sim-catalog {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: calc(var(--topbar-h) + 24px);
}

.sim-catalog-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray-500);
    margin-bottom: 12px;
    padding: 0 8px;
}

.sim-card-link {
    display: block;
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 6px;
    transition: background .15s;
}

.sim-card-link:hover { background: var(--gray-50); text-decoration: none; }
.sim-card-link.active { background: var(--blue-bg); border-left: 3px solid var(--blue); }

.sim-card-mini {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
}

.sim-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sim-card-link.active .sim-card-icon { background: var(--blue); color: var(--white); }

.sim-card-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sim-card-info strong {
    font-size: .9rem;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-card-info span {
    font-size: .75rem;
    color: var(--gray-500);
}

/* Viewer area */
.sim-viewer-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sim-viewer-container {
    position: relative;
    width: 100%;
    height: 450px;
    background: linear-gradient(145deg, var(--gray-100) 0%, var(--gray-50) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* model-viewer fills the container */
model-viewer {
    --poster-color: transparent;
}

.viewer-poster {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.viewer-loading {
    font-size: .9rem;
    color: var(--gray-400);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: .5; }
    50% { opacity: 1; }
}

/* Viewer toolbar */
.viewer-toolbar {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    padding: 6px;
    box-shadow: var(--shadow-md);
}

.viewer-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}

.viewer-btn:hover { background: var(--gray-100); }
.viewer-btn.active { background: var(--blue); color: var(--white); }

/* AR button (inside model-viewer) */
.ar-button {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
}

/* Product details */
.sim-details { padding-bottom: 24px; }

.sim-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sim-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.sim-description {
    font-size: .95rem;
    color: var(--gray-600);
    line-height: 1.6;
    max-width: 700px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sim-layout {
        grid-template-columns: 1fr;
    }
    .sim-catalog {
        position: static;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 12px;
    }
    .sim-catalog-title { display: none; }
    .sim-card-link { flex-shrink: 0; min-width: 180px; margin-bottom: 0; }
    .sim-viewer-container { height: 350px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .login-page {
        flex-direction: column;
    }
    .login-hero {
        padding: 40px 24px;
        min-height: 200px;
    }
    .login-hero h1 { font-size: 1.5rem; }
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .sim-viewer-container { height: 280px; }
    .sim-details-header { flex-direction: column; gap: 8px; }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ==========================================================================
   Page Transitions & Micro-interactions
   ========================================================================== */
.content {
    animation: fadeIn .25s ease-out;
}

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

.btn {
    transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:active {
    transform: scale(0.97);
}

.card {
    transition: box-shadow .2s, transform .15s;
}
.card:hover {
    transform: translateY(-2px);
}

.flash {
    animation: slideIn .3s ease-out;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

a { transition: color .15s; }

tr { transition: background .1s; }

/* ==========================================================================
   Loading States
   ========================================================================== */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
.spinner-dark {
    border-color: rgba(0,0,0,.15);
    border-top-color: var(--blue);
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loading {
    pointer-events: none;
    opacity: .7;
}
.btn-loading .spinner { margin-right: 6px; }

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 120px; }

/* Dark mode removed — Salesforce Lightning is always light.
   Sidebar stays dark (Dark Blue) for visual contrast. */

/* ==========================================================================
   Enhanced Responsive (more breakpoints)
   ========================================================================== */
@media (max-width: 1200px) {
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; height: 52px; }
    .page-title { font-size: 1rem; }
    .breadcrumbs { display: none; }
    .welcome-hero { padding: 20px; }
    .welcome-hero h2 { font-size: 1.2rem; }
    .btn { padding: 8px 14px; font-size: .85rem; }
    .btn-sm { padding: 5px 10px; font-size: .75rem; }
    th, td { padding: 8px 12px; font-size: .8rem; }
    .cards-grid { grid-template-columns: 1fr; gap: 12px; }
    .card { padding: 16px; }
    .card-value { font-size: 1.5rem; }
}
