:root {
    --orange-50: #fff7ed;
    --orange-100: #ffedd5;
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --orange-700: #c2410c;
    --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;
    --green-50: #f0fdf4;
    --green-600: #16a34a;
    --green-700: #15803d;
    --red-50: #fef2f2;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Login ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--orange-50) 0%, var(--gray-50) 50%, #fff 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    border: 1px solid var(--gray-200);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}

.brand-text h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.brand-text p {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.login-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 20px 0 28px;
}

/* ── Dashboard Header ── */
.dashboard {
    min-height: 100vh;
}

.header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header .brand-text h1 {
    font-size: 1.15rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.page-desc {
    color: var(--gray-500);
    font-size: 0.925rem;
    margin-bottom: 32px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

/* ── Card ── */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.card-icon.orange { background: var(--orange-50); color: var(--orange-600); }
.card-icon.blue   { background: #eff6ff; color: #2563eb; }
.card-icon.green  { background: var(--green-50); color: var(--green-600); }

.card-full {
    grid-column: 1 / -1;
}

.form-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 8px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-100);
}

.form-section-title:not(:first-child) {
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.825rem;
    font-weight: 400;
    color: var(--gray-600);
    cursor: pointer;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
}

.card-header p {
    font-size: 0.825rem;
    color: var(--gray-500);
    margin-top: 4px;
    padding-left: 42px;
}

.card-body {
    padding: 20px 24px 24px;
}

/* ── Form ── */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    display: block;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--gray-800);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--orange-400);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="file"] {
    padding: 8px 12px;
    font-size: 0.825rem;
}

.hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.password-toggle:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--orange-400);
    outline-offset: 1px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
    font-family: inherit;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    color: #fff;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--orange-600), var(--orange-700));
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
    padding: 8px 16px;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-50);
    color: var(--gray-800);
}

/* ── Alerts ── */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    margin-bottom: 16px;
    display: none;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.alert.visible {
    display: flex;
}

.alert-success {
    background: var(--green-50);
    color: var(--green-700);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--red-50);
    color: var(--red-700);
    border: 1px solid #fecaca;
}

/* ── Spinner ── */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading .btn-label {
    opacity: 0.85;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 24px 16px 40px;
    }
}
