:root {
  --ink: #172033;
  --muted: #68738a;
  --paper: rgba(255,255,255,.88);
  --line: rgba(23,32,51,.1);
  --purple: #6c4cff;
  --shadow: 0 24px 70px rgba(63, 48, 112, .18);
  --radius: 26px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f8f6ff; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 205, 86, .26), transparent 24rem),
    radial-gradient(circle at 90% 18%, rgba(94, 216, 255, .22), transparent 26rem),
    radial-gradient(circle at 50% 95%, rgba(255, 111, 168, .18), transparent 28rem),
    linear-gradient(145deg, #fbfaff 0%, #f6fbff 52%, #fffaf4 100%);
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
a { color: inherit; }

.ambient { position: fixed; pointer-events: none; filter: blur(2px); opacity: .75; z-index: 0; }
.ambient-a { width: 260px; height: 260px; border-radius: 42% 58% 60% 40%; background: rgba(108,76,255,.08); top: 90px; right: -90px; transform: rotate(18deg); }
.ambient-b { width: 190px; height: 190px; border-radius: 60% 40% 46% 54%; background: rgba(255,101,126,.08); bottom: 40px; left: -60px; }

.app-shell { width: min(1080px, calc(100% - 28px)); margin: 0 auto; position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 43px; height: 43px; border-radius: 15px; display: grid; place-items: center; color: white; font-weight: 900; font-size: 22px; background: linear-gradient(135deg, #6c4cff, #a44cff); box-shadow: 0 9px 25px rgba(108,76,255,.28); transform: rotate(-5deg); }
.brand strong { display: block; font-size: 19px; line-height: 1; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .14em; margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-pill { background: rgba(255,255,255,.68); border: 1px solid rgba(255,255,255,.92); box-shadow: 0 8px 24px rgba(45,43,77,.08); border-radius: 999px; padding: 9px 13px; font-size: 13px; font-weight: 800; }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; text-decoration: none; background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.95); box-shadow: 0 8px 24px rgba(45,43,77,.08); font-weight: 900; }
.content { flex: 1; }
.footer { padding: 44px 0 28px; color: #8a91a3; text-align: center; font-size: 12px; }

.flash { margin: 0 0 16px; padding: 13px 16px; border-radius: 15px; font-weight: 750; font-size: 14px; }
.flash-success { background: #eafff2; color: #126a42; border: 1px solid #b9f2d0; }
.flash-error { background: #fff0f2; color: #a6273b; border: 1px solid #ffc8d0; }
.flash-info { background: #eef5ff; color: #31518f; border: 1px solid #cadcff; }

.hero { min-height: 240px; padding: 36px 38px; border-radius: 34px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 22px; color: white; box-shadow: var(--shadow); background: linear-gradient(118deg, #6547ff 0%, #8f4cff 46%, #ff5b9c 100%); }
.hero::before { content: ""; position: absolute; width: 250px; height: 250px; border: 38px solid rgba(255,255,255,.10); border-radius: 50%; right: 80px; top: -145px; }
.hero::after { content: ""; position: absolute; width: 100px; height: 100px; background: rgba(255,214,80,.25); border-radius: 35% 65% 50% 50%; right: 12%; bottom: -48px; transform: rotate(28deg); }
.hero > * { position: relative; z-index: 1; }
.eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; opacity: .72; }
.hero .eyebrow { color: rgba(255,255,255,.88); opacity: 1; }
.hero h1 { margin: 11px 0 13px; font-size: clamp(36px, 7vw, 68px); line-height: .98; letter-spacing: -.055em; max-width: 760px; }
.hero h1 span { color: #ffe27a; }
.hero p { margin: 0; color: rgba(255,255,255,.82); font-weight: 650; }
.fab { border: 0; width: 60px; height: 60px; border-radius: 22px; cursor: pointer; font-size: 38px; line-height: 1; display: grid; place-items: center; color: #5f40ef; background: white; box-shadow: 0 18px 38px rgba(42,21,123,.28); transition: transform .16s ease, box-shadow .16s ease; }
.fab:hover { transform: translateY(-2px) rotate(3deg); box-shadow: 0 23px 45px rgba(42,21,123,.34); }
.fab-hero { min-width: 70px; min-height: 70px; }

.list-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 24px; }
.list-card { min-height: 210px; border-radius: 27px; padding: 23px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 16px 45px rgba(55,57,93,.09); border: 1px solid rgba(255,255,255,.95); transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; position: relative; }
.list-card::after { content: ""; position: absolute; width: 120px; height: 120px; right: -46px; bottom: -54px; border-radius: 50%; background: rgba(255,255,255,.30); }
.list-card:hover { transform: translateY(-4px) rotate(-.25deg); box-shadow: 0 22px 52px rgba(55,57,93,.14); }
.list-card-top, .list-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-spark { font-size: 24px; }
.count-pill { font-size: 12px; font-weight: 850; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.62); }
.list-card h2 { margin: 24px 0 26px; font-size: clamp(24px, 4vw, 34px); line-height: 1.02; letter-spacing: -.04em; }
.progress-track { height: 8px; border-radius: 999px; background: rgba(23,32,51,.09); overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: rgba(23,32,51,.68); }
.list-card-meta { margin-top: 10px; color: rgba(23,32,51,.68); font-size: 12px; }
.list-card-meta strong { font-size: 14px; color: var(--ink); }
.accent-0 { background: linear-gradient(145deg, #ffe5ef, #ffd2df); }
.accent-1 { background: linear-gradient(145deg, #e9e2ff, #d9d0ff); }
.accent-2 { background: linear-gradient(145deg, #dff7ff, #c9effc); }
.accent-3 { background: linear-gradient(145deg, #fff2bf, #ffe495); }
.accent-4 { background: linear-gradient(145deg, #dcf8e9, #c7efd9); }
.accent-5 { background: linear-gradient(145deg, #ffe9d9, #ffd4b5); }
.accent-6 { background: linear-gradient(145deg, #e5f0ff, #cddfff); }
.accent-7 { background: linear-gradient(145deg, #f8e1ff, #edc8fa); }

.empty-state { margin-top: 24px; background: rgba(255,255,255,.72); border: 1px solid white; box-shadow: 0 16px 44px rgba(55,57,93,.08); border-radius: 28px; padding: 44px 26px; text-align: center; }
.empty-emoji { font-size: 52px; }
.empty-state h2 { margin: 10px 0 8px; font-size: 28px; letter-spacing: -.03em; }
.empty-state p { max-width: 650px; margin: 0 auto 22px; color: var(--muted); line-height: 1.6; }

.primary-btn, .secondary-btn, .tiny-btn { border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 850; }
.primary-btn { min-height: 49px; border-radius: 16px; padding: 0 19px; color: white; background: linear-gradient(135deg, #6c4cff, #9850f8); box-shadow: 0 12px 24px rgba(108,76,255,.22); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.secondary-btn { min-height: 44px; border-radius: 14px; padding: 0 16px; color: var(--ink); background: white; border: 1px solid var(--line); }
.tiny-btn { min-height: 34px; border-radius: 11px; padding: 0 11px; background: #f1eff8; color: #4d4369; font-size: 12px; }
.tiny-btn.danger { color: #ac2942; background: #fff0f2; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(26,26,44,.38); backdrop-filter: blur(10px); }
.modal-card { position: relative; z-index: 1; width: min(480px, 100%); border-radius: 27px; background: rgba(255,255,255,.96); padding: 29px; box-shadow: 0 30px 90px rgba(31,24,70,.34); }
.modal-card h2 { margin: 6px 0 20px; font-size: 30px; letter-spacing: -.04em; }
.modal-close { position: absolute; right: 14px; top: 13px; border: 0; width: 38px; height: 38px; border-radius: 13px; background: #f2effa; cursor: pointer; font-size: 22px; color: #574b6e; }

.stack-form { display: grid; gap: 15px; }
.stack-form label { display: grid; gap: 7px; }
.stack-form label > span { font-size: 12px; font-weight: 850; color: #606a7e; }
input[type="text"], input[type="password"] { width: 100%; min-height: 50px; border-radius: 15px; border: 1px solid rgba(45,48,74,.12); background: #fbfbfd; color: var(--ink); padding: 0 14px; outline: none; transition: border .15s ease, box-shadow .15s ease, background .15s ease; }
input:focus { background: white; border-color: rgba(108,76,255,.55); box-shadow: 0 0 0 4px rgba(108,76,255,.10); }

.auth-page .app-shell { width: min(540px, calc(100% - 28px)); }
.auth-page .topbar { justify-content: center; }
.auth-page .brand { display: none; }
.auth-card { margin: 5vh auto 0; padding: 34px; border-radius: 32px; background: rgba(255,255,255,.82); border: 1px solid white; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-badge { display: inline-flex; padding: 8px 11px; background: #fff2bd; border-radius: 999px; font-size: 12px; font-weight: 900; color: #6e5613; }
.auth-card h1 { font-size: clamp(40px, 9vw, 60px); margin: 15px 0 6px; letter-spacing: -.06em; line-height: .96; background: linear-gradient(135deg, #6c4cff, #f05495); -webkit-background-clip: text; color: transparent; }
.lead { color: var(--muted); line-height: 1.55; margin: 0 0 24px; }

.list-page-head { border-radius: 30px; padding: 28px 30px; box-shadow: 0 17px 48px rgba(54,57,92,.10); border: 1px solid rgba(255,255,255,.92); }
.accent-bg-0 { background: linear-gradient(135deg, #ffd7e4, #fff0f5); }
.accent-bg-1 { background: linear-gradient(135deg, #ded6ff, #f3efff); }
.accent-bg-2 { background: linear-gradient(135deg, #ccefff, #eefaff); }
.accent-bg-3 { background: linear-gradient(135deg, #ffe695, #fff6d7); }
.accent-bg-4 { background: linear-gradient(135deg, #c9f0db, #effbf4); }
.accent-bg-5 { background: linear-gradient(135deg, #ffd4b5, #fff0e5); }
.accent-bg-6 { background: linear-gradient(135deg, #cfdfff, #f0f5ff); }
.accent-bg-7 { background: linear-gradient(135deg, #edccf8, #faefff); }
.back-link { display: inline-block; margin-bottom: 24px; text-decoration: none; font-size: 13px; font-weight: 850; color: rgba(23,32,51,.63); }
.list-title-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.list-title-row h1 { margin: 5px 0 6px; font-size: clamp(36px, 7vw, 64px); line-height: .95; letter-spacing: -.055em; }
.list-title-row p { margin: 0; color: rgba(23,32,51,.64); font-weight: 700; }
.quick-add { display: flex; gap: 10px; margin: 18px 0; padding: 9px; border-radius: 20px; background: rgba(255,255,255,.76); border: 1px solid white; box-shadow: 0 12px 34px rgba(55,57,93,.08); }
.quick-add input { min-width: 0; flex: 1; border: 0; background: transparent; box-shadow: none; font-weight: 700; }
.quick-add button { border: 0; min-width: 52px; height: 52px; border-radius: 16px; background: var(--ink); color: white; font-size: 30px; cursor: pointer; }
.items { display: grid; gap: 10px; }
.item-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 68px; padding: 10px 11px; border-radius: 20px; background: rgba(255,255,255,.80); border: 1px solid rgba(255,255,255,.96); box-shadow: 0 8px 25px rgba(55,57,93,.06); transition: opacity .15s ease, transform .15s ease; }
.item-row:hover { transform: translateY(-1px); }
.item-text { min-width: 0; font-size: 17px; font-weight: 760; line-height: 1.35; overflow-wrap: anywhere; }
.item-row.is-done { opacity: .54; }
.item-row.is-done .item-text { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(23,32,51,.55); }
.check-btn, .delete-btn { width: 43px; height: 43px; border-radius: 14px; border: 0; cursor: pointer; font-size: 20px; font-weight: 900; }
.check-btn { color: #287a55; background: #ddf7e9; }
.is-done .check-btn { color: #5e50a6; background: #ece8ff; }
.delete-btn { color: #b3314c; background: #fff0f2; }
.empty-list-row { padding: 32px 22px; border: 2px dashed rgba(108,76,255,.17); border-radius: 22px; color: var(--muted); text-align: center; font-weight: 700; }

.admin-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 20px 0 8px; }
.admin-head h1 { margin: 5px 0; font-size: 54px; letter-spacing: -.055em; }
.admin-head p { margin: 0; color: var(--muted); }
.tabs { display: flex; gap: 8px; margin: 22px 0; padding: 6px; border-radius: 17px; background: rgba(255,255,255,.68); width: fit-content; border: 1px solid white; }
.tabs a { padding: 10px 14px; border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 850; color: var(--muted); }
.tabs a.active { color: white; background: var(--ink); }
.admin-grid { display: grid; grid-template-columns: minmax(260px, .7fr) 1.3fr; gap: 18px; }
.panel { border-radius: 25px; padding: 22px; background: rgba(255,255,255,.77); border: 1px solid white; box-shadow: 0 12px 38px rgba(55,57,93,.07); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.035em; }
.admin-list { display: grid; gap: 9px; }
.admin-user-row { border: 1px solid var(--line); border-radius: 16px; padding: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(255,255,255,.68); flex-wrap: wrap; }
.admin-user-row > div:first-child { display: grid; gap: 2px; }
.admin-user-row strong { font-size: 15px; }
.admin-user-row span { font-size: 11px; color: var(--muted); }
.admin-row-actions { display: flex !important; flex-direction: row !important; gap: 6px !important; align-items: center; }
.admin-row-actions form { margin: 0; }
.inline-reset { flex: 1 0 100%; display: flex; gap: 7px; }
.inline-reset[hidden] { display: none; }
.inline-reset input { min-height: 38px; }
.rename-form { flex: 1; display: grid; grid-template-columns: minmax(150px, 1fr) auto auto; gap: 8px; align-items: center; }
.rename-form input { min-height: 39px; }
.log-table-wrap { overflow-x: auto; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th, .log-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.status.ok { color: #17714a; background: #ddf7e9; }
.status.bad { color: #a62f46; background: #ffe5e9; }

@media (max-width: 820px) {
  .list-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .app-shell { width: min(100% - 20px, 1080px); }
  .topbar { min-height: 76px; }
  .user-pill { display: none; }
  .hero { min-height: 220px; padding: 27px 23px; border-radius: 27px; align-items: end; }
  .hero h1 { font-size: 44px; }
  .hero p { max-width: 78%; }
  .fab-hero { min-width: 58px; min-height: 58px; width: 58px; height: 58px; border-radius: 19px; }
  .list-grid { grid-template-columns: 1fr; gap: 12px; }
  .list-card { min-height: 175px; }
  .list-page-head { padding: 23px 19px; }
  .list-title-row { align-items: center; }
  .list-title-row h1 { font-size: 40px; }
  .list-title-row .fab { width: 52px; height: 52px; min-width: 52px; border-radius: 17px; }
  .auth-card { padding: 26px 20px; border-radius: 26px; }
  .admin-head { align-items: flex-start; flex-direction: column; }
  .admin-head h1 { font-size: 44px; }
  .tabs { width: 100%; overflow-x: auto; }
  .tabs a { flex: 1; text-align: center; white-space: nowrap; }
  .admin-user-row { align-items: flex-start; }
  .admin-row-actions { width: 100%; }
  .rename-form { grid-template-columns: 1fr auto; width: 100%; }
  .rename-form span { grid-column: 1; }
  .rename-form button { grid-column: 2; grid-row: 1 / span 2; }
  .list-admin-row > .admin-row-actions { width: auto; }
}
