:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --sidebar-bg: #111827;
    --sidebar-text: #d1d5db;
    --sidebar-hover: #1f2937;
    --sidebar-active: #2563eb;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* App Shell */
.frame-shell {
    display: flex;
    min-height: 100vh;
}

.frame-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.9rem;
}

.frame-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.6rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
}

.frame-brand:hover {
    text-decoration: none;
}

.frame-nav-section {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    padding: 0.75rem 0.6rem 0.35rem;
}

.frame-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.frame-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 0.93rem;
    transition: background 0.15s ease;
}

.frame-nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.frame-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.frame-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.frame-user-name {
    color: #fff;
    font-weight: 600;
}

.frame-user-email {
    color: #9ca3af;
    font-size: 0.78rem;
    margin-bottom: 0.6rem;
    word-break: break-all;
}

.frame-main {
    flex: 1;
    padding: 2rem 2.25rem;
    max-width: 1200px;
    width: 100%;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 1.65rem;
}

.page-subtitle {
    color: var(--text-muted);
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
}

/* Cards & Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.app-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.app-card-icon {
    font-size: 1.9rem;
    line-height: 1;
}

.app-card h2 {
    margin: 0;
    font-size: 1.15rem;
}

.app-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex: 1;
}

/* Tables */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

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

th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

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

/* Buttons & Badges */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    background: var(--primary);
    color: #fff;
}

.btn:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #f3f4f6;
}

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

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

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
}

.badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
    margin: 0.1rem 0.15rem 0.1rem 0;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-muted {
    background: #f3f4f6;
    color: #4b5563;
}

/* Alerts */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
}

/* Forms */
.form-card {
    max-width: 640px;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

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

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f9fafb;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    margin: 0;
    cursor: pointer;
}

.form-errors {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Login */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.actions-inline {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}
