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

:root {
    --bg: #0e1117;
    --bg-2: #141a24;
    --bg-3: #1a2130;
    --border: rgba(255, 255, 255, 0.06);
    --border-2: rgba(255, 255, 255, 0.1);
    --text: #e6edf5;
    --text-dim: rgba(230, 237, 245, 0.55);
    --text-mute: rgba(230, 237, 245, 0.3);
    --accent: #a78bfa;
    --accent-2: #f472b6;
    --accent-grad: linear-gradient(135deg, #a78bfa, #f472b6);
    --success: #34d399;
    --danger: #f87171;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(ellipse 80% 60% at 10% -10%, rgba(167, 139, 250, 0.08), transparent),
        radial-gradient(ellipse 70% 50% at 100% 100%, rgba(244, 114, 182, 0.06), transparent);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(14, 17, 23, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark { color: var(--accent); font-size: 20px; }
.brand-accent { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.header-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav-link { font-size: 14px; color: var(--text-dim); padding: 8px 14px; border-radius: var(--radius-sm); transition: 0.2s; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-link-accent { color: var(--text); background: rgba(167, 139, 250, 0.12); border: 1px solid rgba(167, 139, 250, 0.2); }
.nav-link-accent:hover { background: rgba(167, 139, 250, 0.2); }

.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 20px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); }
.user-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }
.user-name { font-size: 13px; color: var(--text-dim); }

.inline-form { display: inline; }
.inline-form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer; border: none;
    font-family: inherit; transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-primary { background: var(--accent-grad); color: #0e1117; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(167, 139, 250, 0.3); }

.btn-secondary { background: rgba(255, 255, 255, 0.04); color: var(--text); border: 1px solid var(--border-2); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }

.btn-danger { background: rgba(248, 113, 113, 0.12); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.2); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); transform: translateY(-2px); }

.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

.btn-block { width: 100%; }

.btn-icon-danger {
    width: 30px; height: 30px; border-radius: 50%; border: none;
    background: rgba(248, 113, 113, 0.08); color: var(--danger);
    cursor: pointer; font-size: 13px; transition: 0.2s;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon-danger:hover { background: rgba(248, 113, 113, 0.2); transform: scale(1.1); }

/* ===== PAGE ===== */
.page { max-width: 1180px; width: 100%; margin: 0 auto; padding: 40px 24px 60px; flex: 1; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.page-title { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.page-subtitle { font-size: 15px; color: var(--text-dim); margin-top: 4px; }

.section-title { font-size: 18px; font-weight: 600; margin: 32px 0 16px; color: var(--text-dim); }

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
    padding: 16px; background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border); border-radius: var(--radius);
}

.search-field { flex: 1; min-width: 200px; position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 14px; color: var(--text-mute); font-size: 18px; pointer-events: none; }
.search-field .input { padding-left: 42px; }

.input, .select {
    width: 100%; padding: 11px 16px; background: var(--bg-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-family: inherit;
    transition: 0.2s; appearance: none;
}

.input:focus, .select:focus { outline: none; border-color: rgba(167, 139, 250, 0.4); background: var(--bg-3); }
.input::placeholder { color: var(--text-mute); }

.select {
    min-width: 180px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(230,237,245,0.4)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
.select option { background: var(--bg-2); color: var(--text); }

.search-note { font-size: 14px; color: var(--text-dim); margin-bottom: 20px; }
.search-note b { color: var(--text); }
.link-reset { margin-left: 12px; color: var(--accent); }

/* ===== GRID / CARDS ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

.card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 22px; background: linear-gradient(160deg, var(--bg-2), var(--bg));
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; overflow: hidden;
}

.card::before {
    content: ''; position: absolute; inset: 0; border-radius: var(--radius); padding: 1px;
    background: var(--accent-grad); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: 0.3s; pointer-events: none;
}

.card:hover { transform: translateY(-6px); border-color: rgba(167, 139, 250, 0.2); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4); }
.card:hover::before { opacity: 1; }

.card-done { opacity: 0.75; }
.card-done .card-title { text-decoration: line-through; color: var(--text-dim); }
.card-inactive { opacity: 0.5; }

.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-status { font-size: 20px; font-weight: 700; }
.status-done { color: var(--success); }
.status-pending { color: var(--text-mute); }

.card-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.3; }
.card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.card-foot { margin-top: auto; display: flex; align-items: center; gap: 12px; }

.progress { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.05); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent-grad); border-radius: 10px; transition: width 0.5s ease; }
.progress-label { font-size: 12px; font-weight: 600; color: var(--text-dim); white-space: nowrap; }

.chip { font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.chip-ok { background: rgba(52, 211, 153, 0.12); color: var(--success); border: 1px solid rgba(52, 211, 153, 0.15); }
.chip-muted { background: rgba(255, 255, 255, 0.04); color: var(--text-mute); border: 1px solid var(--border); }

/* ===== DETAIL ===== */
.back-link { display: inline-block; font-size: 14px; color: var(--text-dim); margin-bottom: 24px; transition: 0.2s; }
.back-link:hover { color: var(--accent); transform: translateX(-4px); }

.detail { max-width: 720px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }

.detail-stats { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 100px; padding: 18px 20px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.stat-value { display: block; font-size: 28px; font-weight: 800; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { display: block; font-size: 12px; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.panel { padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); margin-bottom: 24px; }
.panel-accent { border-color: rgba(167, 139, 250, 0.2); background: rgba(167, 139, 250, 0.04); }
.panel-success { display: flex; align-items: center; gap: 12px; border-color: rgba(52, 211, 153, 0.2); background: rgba(52, 211, 153, 0.05); color: var(--success); }
.panel-danger { border-color: rgba(248, 113, 113, 0.2); background: rgba(248, 113, 113, 0.04); }
.panel-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.panel-icon { font-size: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.field input, .field textarea, .field select { padding: 11px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit; transition: 0.2s; }
.field input:focus, .field textarea:focus { outline: none; border-color: rgba(167, 139, 250, 0.4); background: var(--bg-3); }
.field textarea { resize: vertical; min-height: 80px; }
.field-error { font-size: 13px; color: var(--danger); }
.field-hint { font-size: 12px; color: var(--text-mute); line-height: 1.4; }
.field-hint ul { list-style: none; padding: 0; }

.log-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.log-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: 0.2s; }
.log-item:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--border-2); }
.log-time { font-size: 16px; font-weight: 600; color: var(--text); }
.log-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 1; opacity: 0.3; }

.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ===== FORMS ===== */
.form-wrap { max-width: 480px; margin: 0 auto; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 24px; }

/* ===== AUTH ===== */
.auth-wrap { max-width: 420px; margin: 40px auto; padding: 40px 36px; background: linear-gradient(160deg, var(--bg-2), var(--bg)); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.auth-title { font-size: 28px; font-weight: 800; text-align: center; }
.auth-subtitle { font-size: 14px; color: var(--text-dim); text-align: center; margin-top: 6px; margin-bottom: 8px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-dim); }
.auth-foot a { color: var(--accent); font-weight: 600; }
.form-alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: #f87171;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

/* ===== EMPTY ===== */
.empty { text-align: center; padding: 80px 20px; color: var(--text-mute); }
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty p { font-size: 18px; margin-bottom: 20px; }

/* ===== TOASTS ===== */
.toast-stack { position: fixed; top: 90px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast { padding: 14px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; backdrop-filter: blur(10px); animation: slideIn 0.3s ease; }
.toast-success { background: rgba(52, 211, 153, 0.15); border: 1px solid rgba(52, 211, 153, 0.3); color: var(--success); }
.toast-error { background: rgba(248, 113, 113, 0.15); border: 1px solid rgba(248, 113, 113, 0.3); color: var(--danger); }
.toast-info { background: rgba(167, 139, 250, 0.15); border: 1px solid rgba(167, 139, 250, 0.3); color: var(--accent); }

@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 28px 20px; color: var(--text-mute); font-size: 13px; border-top: 1px solid var(--border); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ===== ADAPTIVE ===== */
@media (max-width: 720px) {
    .header-inner { padding: 12px 16px; flex-wrap: wrap; }
    .header-nav { width: 100%; justify-content: center; }
    .page { padding: 24px 16px 40px; }
    .page-title { font-size: 26px; }
    .page-head { flex-direction: column; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .card { padding: 16px; }
    .card-title { font-size: 15px; }
    .detail-stats { gap: 10px; }
    .stat { min-width: 80px; padding: 14px; }
    .stat-value { font-size: 22px; }
    .detail-actions { flex-direction: column; }
    .detail-actions .btn-secondary, .detail-actions .btn-danger, .detail-actions .inline-form { width: 100%; }
    .detail-actions .inline-form button { width: 100%; }
    .toast-stack { left: 16px; right: 16px; max-width: none; top: 80px; }
    .auth-wrap { padding: 28px 22px; margin: 20px auto; }
    .inline-form-row { flex-direction: column; align-items: stretch; }
}