:root {
    --bg-dark: #020617;
    --bg-card: #0f172a;
    --bg-card-hover: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #1e293b;
    
    font-family: 'Fira Sans', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6, table {
    font-family: 'Fira Code', monospace;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    min-width: 340px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

.login-container h1 { 
    margin-bottom: 24px; 
    text-align: center; 
    color: var(--text-main);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Fira Sans', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { 
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.3);
}

.btn-red {
    background: var(--danger);
    color: #fff;
}
.btn-red:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}
a:hover {
    color: var(--primary-hover);
}

/* Dashboard Layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar .logo {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 32px;
    color: var(--primary);
    font-family: 'Fira Code', monospace;
}

.sidebar nav { flex: 1; }

.nav-link {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: var(--bg-dark);
}

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

.page-section { display: none; animation: fadeIn 0.3s ease; }
.page-section.active { display: block; }

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    border-color: var(--bg-card-hover);
}

.stat-card h3 {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
    font-family: 'Fira Sans', sans-serif;
}

.stat-card p {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    font-size: 14px;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th { 
    background: var(--bg-dark); 
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: var(--bg-card-hover);
}

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

.table-container {
    overflow-x: auto;
    border-radius: 8px;
}

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content h3 {
    margin-bottom: 24px;
    font-size: 20px;
    color: var(--text-main);
}

.modal-content input, .modal-content textarea, .modal-content select { 
    margin-bottom: 20px; 
}
.modal-content button { 
    margin-right: 8px; 
}

/* Dashboard UI Improvements & Glassmorphism */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.glass-card {
    background: rgba(42, 43, 54, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.glass-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}
.glass-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.metric-value {
    font-size: 32px;
    font-weight: 700;
    margin: 8px 0;
    font-family: 'Fira Code', monospace;
    background: linear-gradient(to right, #4ade80, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.metric-title {
    font-size: 13px;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.metric-icon {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 28px;
    opacity: 0.15;
}

/* Specific glows */
.glass-card.warning-glow {
    border-left: 3px solid #f59e0b;
}
.glass-card.warning-glow .metric-value {
    background: linear-gradient(to right, #f59e0b, #ea580c);
    -webkit-background-clip: text;
}
.glass-card.danger-glow {
    border-left: 3px solid #ef4444;
}
.glass-card.danger-glow .metric-value {
    background: linear-gradient(to right, #ef4444, #b91c1c);
    -webkit-background-clip: text;
}

.chart-container-glass {
    background: rgba(42, 43, 54, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
}

.urgent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.urgent-item {
    background: rgba(0,0,0,0.2);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--primary);
}
.urgent-item.danger {
    border-left-color: #ef4444;
}
.urgent-item.warning {
    border-left-color: #f59e0b;
}

/* Actions Menu Dropdown */
.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.actions-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    min-width: 160px;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    z-index: 100;
    overflow: hidden;
    margin-top: 4px;
}

.actions-menu.show {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.actions-menu button {
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions-menu button:hover {
    background: var(--bg-card-hover);
}

.actions-menu button.danger-action {
    color: #ef4444;
}
.actions-menu button.danger-action:hover {
    background: rgba(239, 68, 68, 0.1);
}
