/* ============================================================
   StockMaster Pro — Design System & Styles
   Palette: White + Green Accents (Multiple Shades)
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Greens */
    --green-50:  #ecfdf5;
    --green-100: #d1fae5;
    --green-200: #a7f3d0;
    --green-300: #6ee7b7;
    --green-400: #34d399;
    --green-500: #10b981;
    --green-600: #059669;
    --green-700: #047857;
    --green-800: #065f46;
    --green-900: #064e3b;

    /* Neutrals */
    --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;
    --gray-900: #111827;

    /* Accent Colors */
    --amber-500: #f59e0b;
    --amber-100: #fef3c7;
    --red-500:   #ef4444;
    --red-100:   #fee2e2;
    --teal-500:  #14b8a6;
    --teal-100:  #ccfbf1;

    /* Semantic */
    --primary:       var(--green-600);
    --primary-hover:  var(--green-700);
    --primary-light:  var(--green-50);
    --primary-lighter: var(--green-100);
    --bg-body:        var(--gray-50);
    --bg-white:       #ffffff;
    --text-primary:   var(--gray-900);
    --text-secondary: var(--gray-500);
    --text-muted:     var(--gray-400);
    --border-color:   var(--gray-200);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.08);
    --shadow-xl:  0 20px 50px rgba(0,0,0,0.12);

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4,0,0.2,1);
    --transition-base: 0.25s cubic-bezier(0.4,0,0.2,1);
    --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--green-900) 0%, var(--green-800) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-text-accent {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--green-400);
    letter-spacing: -0.04em;
    margin-right: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--green-300);
    margin-top: 1px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    padding: 16px 12px 6px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255,255,255,0.65);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    text-align: left;
}

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

.nav-item.active {
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--green-400);
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active svg {
    opacity: 1;
    color: var(--green-300);
}

.nav-badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    padding: 2px 8px;
    border-radius: 99px;
    min-width: 24px;
    text-align: center;
}

.nav-item.active .nav-badge {
    background: var(--green-500);
    color: #fff;
}

/* Nav Dropdown */
.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    margin-top: 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    letter-spacing: 0.02em;
}

.nav-dropdown-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-dropdown-toggle.open {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-dropdown-toggle svg:first-child {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-dropdown-toggle .nav-badge {
    margin-left: auto;
}

.dropdown-chevron {
    flex-shrink: 0;
    transition: transform var(--transition-base);
    opacity: 0.5;
    margin-left: 4px;
}

.nav-dropdown-toggle.open .dropdown-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow) ease;
    padding-left: 8px;
    border-left: 2px solid rgba(255,255,255,0.08);
    margin-left: 18px;
    margin-top: 2px;
}

.nav-dropdown-menu.open {
    max-height: 500px;
}

.nav-dropdown-menu .nav-item {
    padding: 8px 12px;
    font-size: 0.83rem;
}

/* Supplier Dot */
.supplier-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--green-400);
    flex-shrink: 0;
}

/* Supplier Card */
.supplier-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 28px 32px;
    margin-bottom: 20px;
    transition: all var(--transition-base);
}

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

.supplier-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.supplier-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.supplier-card-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.supplier-card-title p {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.supplier-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.supplier-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.supplier-info-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--green-50);
    color: var(--green-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.supplier-info-data {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.supplier-info-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

.supplier-info-value a {
    color: var(--green-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.supplier-info-value a:hover {
    color: var(--green-800);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .supplier-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

.footer-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--green-400);
    animation: pulse 2s ease-in-out infinite;
}

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

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Top Bar ---------- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--gray-100);
}

.topbar-left {
    flex: 1;
}

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

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

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    transition: all var(--transition-fast);
    width: 240px;
}

.search-box:focus-within {
    border-color: var(--green-400);
    background: #fff;
    box-shadow: 0 0 0 3px var(--green-50);
}

.search-box svg {
    color: var(--gray-400);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--gray-400);
}

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

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 99px;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================
   CONTENT VIEWS
   ============================================================ */
.content-view {
    display: none;
    padding: 28px;
    flex: 1;
    animation: fadeIn var(--transition-base) ease;
}

.content-view.active {
    display: block;
}

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

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

/* Widget Card */
.widget {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    cursor: default;
}

.widget:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.widget-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.widget-icon.green {
    background: var(--green-50);
    color: var(--green-600);
}

.widget-icon.amber {
    background: var(--amber-100);
    color: var(--amber-500);
}

.widget-icon.teal {
    background: var(--teal-100);
    color: var(--teal-500);
}

.widget-icon.red {
    background: var(--red-100);
    color: var(--red-500);
}

.widget-data {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.widget-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.widget-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Dashboard Bottom */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}

/* Card */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Chart Bars */
.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chart-bar-label {
    width: 80px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.chart-bar-track {
    flex: 1;
    height: 26px;
    background: var(--gray-50);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--green-400), var(--green-600));
    transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94);
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
}

.chart-bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
}

/* Activity List */
.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 320px;
    overflow-y: auto;
}

.activity-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-empty {
    color: var(--text-muted) !important;
    justify-content: center !important;
    padding: 32px 0 !important;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    flex-shrink: 0;
}

.activity-dot.add    { background: var(--green-500); }
.activity-dot.edit   { background: var(--amber-500); }
.activity-dot.delete { background: var(--red-500); }

.activity-time {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ============================================================
   CATEGORY VIEW HEADER
   ============================================================ */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.view-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.view-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================================
   TABLE CONTROLS
   ============================================================ */
.table-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    flex: 1;
    max-width: 340px;
    transition: all var(--transition-fast);
}

.table-search:focus-within {
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px var(--green-50);
}

.table-search svg {
    color: var(--gray-400);
    flex-shrink: 0;
}

.table-search input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    width: 100%;
}

.table-search input::placeholder {
    color: var(--gray-400);
}

.table-filter select {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
}

.table-filter select:focus {
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px var(--green-50);
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--green-50);
}

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

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.73rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 99px;
}

.status-badge.attivo,
.status-badge.consegnato {
    background: var(--green-50);
    color: var(--green-700);
}
.status-badge.attivo::before,
.status-badge.consegnato::before {
    background: var(--green-500);
}

.status-badge.manutenzione,
.status-badge.in-attesa,
.status-badge.spedito {
    background: var(--amber-100);
    color: #92400e;
}
.status-badge.manutenzione::before,
.status-badge.in-attesa::before,
.status-badge.spedito::before {
    background: var(--amber-500);
}

.status-badge.dismesso,
.status-badge.annullato {
    background: var(--red-100);
    color: #991b1b;
}
.status-badge.dismesso::before,
.status-badge.annullato::before {
    background: var(--red-500);
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    color: var(--gray-400);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.action-btn.delete:hover {
    background: var(--red-100);
    color: var(--red-500);
}

/* Table Empty State */
.table-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    color: var(--text-muted);
}

.table-empty svg {
    opacity: 0.3;
}

.table-empty p {
    font-size: 0.9rem;
    font-weight: 500;
}

.table-empty.visible {
    display: flex;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: #fff;
    box-shadow: 0 2px 8px rgba(5,150,105,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--green-600), var(--green-800));
    box-shadow: 0 4px 16px rgba(5,150,105,0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--green-300);
}

.btn-outline:hover {
    background: var(--green-50);
    border-color: var(--green-500);
}

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

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--red-500);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 16px rgba(239,68,68,0.35);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    animation: overlayIn var(--transition-fast) ease;
}

.modal-overlay.active {
    display: flex;
}

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

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn var(--transition-base) ease;
    display: flex;
    flex-direction: column;
}

.modal-sm {
    max-width: 420px;
}

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

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    color: var(--gray-400);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

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

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

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-white);
    outline: none;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--green-400);
    box-shadow: 0 0 0 3px var(--green-50);
}

.form-group textarea {
    resize: vertical;
    min-height: 72px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.toast {
    background: var(--gray-800);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn var(--transition-base) ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
}

.toast.success { border-left: 4px solid var(--green-500); }
.toast.error   { border-left: 4px solid var(--red-500); }
.toast.info    { border-left: 4px solid var(--amber-500); }

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

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .menu-toggle {
        display: flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .content-view {
        padding: 20px 16px;
    }

    .search-box {
        display: none;
    }

    .user-name {
        display: none;
    }

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

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

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 10px;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
/* ============================================================
   AUTH & LOGIN
   ============================================================ */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-50);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-overlay.active {
    display: flex;
}

.login-card {
    background: #fff;
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    text-align: center;
    animation: fadeIn var(--transition-slow) ease;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-error {
    color: var(--red-500);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 12px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: none;
    color: rgba(255,255,255,0.6);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(255,68,68,0.15);
    color: #ff8888;
}

.btn-logout svg {
    opacity: 0.8;
}
