:root {
    --bg-color: #FAF8F5; /* Warm cream */
    --surface-color: #ffffff;
    --primary: #6B21A8; /* Deep purple */
    --primary-hover: #581C87;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --danger: #EF4444;
    --success: #10B981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}
.screen.active {
    display: flex;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
}
.login-card {
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.login-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}
input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}
input:focus {
    outline: none;
    border-color: var(--primary);
}
button {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}
button:hover {
    background-color: var(--primary-hover);
}
button:active {
    transform: scale(0.98);
}
.error-msg {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* Dashboard Layout */
.sidebar {
    width: 250px;
    background: var(--surface-color);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
}
.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    padding: 0 1.5rem 2rem;
}
.nav-links {
    list-style: none;
    flex: 1;
}
.nav-links li {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}
.nav-links li:hover, .nav-links li.active {
    background: rgba(107, 33, 168, 0.05);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}
.logout {
    margin: 1.5rem;
    width: auto;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.logout:hover {
    background: rgba(0,0,0,0.05);
}

.content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.view {
    display: none;
}
.view.active {
    display: block;
}
h2 {
    margin-bottom: 2rem;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.stat-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.stat-card p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Tables */
.header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.header-action button {
    width: auto;
}
.table-container {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
th {
    background: #F9FAFB;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
td {
    font-size: 0.875rem;
}
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-active { background: #D1FAE5; color: #065F46; }
.status-expired { background: #FEE2E2; color: #991B1B; }
.status-disabled { background: #F3F4F6; color: #374151; }

.action-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    width: auto;
    background: var(--danger);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    position: relative;
}
.close-btn {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}
select {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: white;
}
.result-msg {
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    word-break: break-all;
    text-align: center;
}
.result-success { color: var(--success); }
