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

:root {
    --bg:        #0f1117;
    --surface:   #1c1f2a;
    --surface2:  #252836;
    --border:    #2e3247;
    --accent:    #4f8ef7;
    --accent-h:  #3a76e0;
    --danger:    #e05c5c;
    --danger-h:  #c94040;
    --success:   #4caf7e;
    --text:      #e4e6f0;
    --muted:     #7b80a0;
    --radius:    12px;
    --shadow:    0 8px 32px rgba(0,0,0,.45);
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
}

.card.wide { max-width: 680px; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.card-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 2rem;
}

.card-header .icon {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.card-header h1 { font-size: 1.35rem; font-weight: 700; }
.card-header p  { font-size: .85rem; color: var(--muted); margin-top: .2rem; }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.2rem; }

label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .45rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .95rem;
    padding: .7rem 1rem;
    outline: none;
    transition: border-color .18s;
    font-family: inherit;
    resize: vertical;
}

input:focus, textarea:focus {
    border-color: var(--accent);
}

input::placeholder, textarea::placeholder { color: var(--muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    padding: .75rem 1.5rem;
    transition: background .18s, transform .12s;
    font-family: inherit;
    text-decoration: none;
}

.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--accent);  color: #fff; width: 100%; }
.btn-primary:hover  { background: var(--accent-h); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover  { filter: brightness(1.1); }

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: .85rem;
    padding: .5rem 1rem;
}
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

/* ── Alert ────────────────────────────────────────────────────────────────── */
.alert {
    border-radius: 8px;
    padding: .8rem 1rem;
    font-size: .88rem;
    margin-bottom: 1.2rem;
    border-left: 4px solid;
}

.alert-error   { background: rgba(224,92,92,.12); border-color: var(--danger);  color: #f09090; }
.alert-success { background: rgba(76,175,126,.12); border-color: var(--success); color: #80dfb0; }
.alert-info    { background: rgba(79,142,247,.12); border-color: var(--accent);  color: #90baff; }

/* ── Status badge ─────────────────────────────────────────────────────────── */
.status-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
    padding: .3rem .85rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

.badge-on  { background: rgba(76,175,126,.2); color: var(--success); border: 1px solid rgba(76,175,126,.3); }
.badge-off { background: rgba(123,128,160,.15); color: var(--muted);   border: 1px solid var(--border); }

.status-row .label { flex: 1; }
.status-row .label strong { display: block; font-size: 1rem; }
.status-row .label span  { font-size: .82rem; color: var(--muted); }

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ── Row utilities ────────────────────────────────────────────────────────── */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.action-row {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ── User info bar ────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: .35rem .9rem .35rem .5rem;
    font-size: .87rem;
}

.avatar {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.btn .spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
    margin-top: 2rem;
    font-size: .78rem;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 540px) {
    .card { padding: 1.5rem; }
    .row-2 { grid-template-columns: 1fr; }
}
