@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #7c3aed;
  --secondary: #2563eb;
  --ink: #182033;
  --muted: #6b7280;
  --line: rgba(124, 58, 237, .13);
  --card: rgba(255, 255, 255, .82);
  --surface: #f7f6ff;
  --shadow: 0 22px 60px rgba(51, 38, 102, .13);
  --radius: 20px;
}

[data-theme="dark"] {
  --ink: #f6f7fb;
  --muted: #aeb7ca;
  --line: rgba(255, 255, 255, .12);
  --card: rgba(24, 28, 45, .78);
  --surface: #111525;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Poppins, sans-serif;
  background:
    radial-gradient(circle at 8% 3%, rgba(124, 58, 237, .22), transparent 30rem),
    radial-gradient(circle at 92% 10%, rgba(37, 99, 235, .18), transparent 27rem),
    var(--surface);
  transition: background .35s ease, color .35s ease;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card, .panel, .stat-card, .task-card, .hero-panel, .settings-list article, .chart-panel, .badges article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
  animation: fadeUp .5s ease both;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.35rem; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.auth-card h1, .hero-panel h1 { margin: 22px 0 6px; font-size: clamp(2rem, 8vw, 3.7rem); line-height: 1; letter-spacing: 0; }
.auth-card p, .hero-panel p, .task-card p, .panel p { color: var(--muted); }
.field { display: grid; gap: 8px; margin: 16px 0; color: var(--muted); font-weight: 600; }
input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  outline: none;
}
[data-theme="dark"] input, [data-theme="dark"] select { background: rgba(255, 255, 255, .08); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124, 58, 237, .12); }

.primary-btn, .icon-btn, .entry-form button, .settings-list button, .file-btn {
  border: 0;
  border-radius: 14px;
  min-height: 46px;
  padding: 0 16px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 12px 25px rgba(37, 99, 235, .22);
}
.primary-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0; font-size: .9rem; }
.auth-row label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.auth-row input { width: auto; min-height: auto; }
.link-btn { border: 0; padding: 0; color: var(--secondary); background: transparent; }

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; border-right: 1px solid var(--line); }
.nav { display: grid; gap: 8px; margin-top: 32px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 14px; color: var(--muted); }
.nav a.active, .nav a:hover { color: white; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.main { padding: 24px 24px 96px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: clamp(1.7rem, 5vw, 3rem); }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.search-box { position: relative; width: min(340px, 100%); }
.search-box i { position: absolute; left: 14px; top: 13px; color: var(--muted); }
.search-box input { padding-left: 42px; }

.hero-panel { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: 28px; margin-bottom: 22px; overflow: hidden; }
.eyebrow { margin: 0; color: var(--secondary); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.goal-ring { display: grid; place-items: center; width: 132px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--primary) 70%, rgba(124,58,237,.12) 0); color: white; }
.goal-ring span { font-size: 2.3rem; font-weight: 800; }
.goal-ring small { margin-top: -20px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { padding: 18px; display: grid; gap: 8px; }
.stat-card i { color: var(--primary); }
.stat-card span { color: var(--muted); font-size: .9rem; }
.stat-card strong { font-size: 1.8rem; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { padding: 20px; }
.panel h2 { margin: 0 0 14px; font-size: 1.1rem; }

.entry-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr .8fr auto; gap: 10px; margin-bottom: 18px; }
.project-entry-form { grid-template-columns: 1.1fr .8fr 1.2fr .85fr .75fr .75fr auto; }
.list-stack, .project-grid { display: grid; gap: 14px; }
.project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.task-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px; animation: fadeUp .35s ease both; }
.task-card.done { opacity: .62; }
.task-card h3 { margin: 8px 0 4px; }
.pill { display: inline-flex; border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 700; background: rgba(37, 99, 235, .12); color: var(--secondary); }
.pill.high { background: rgba(220, 38, 38, .12); color: #dc2626; }
.pill.low { background: rgba(15, 118, 110, .12); color: #0f766e; }
.card-actions { display: flex; gap: 8px; }
.card-actions button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; color: var(--ink); background: rgba(124, 58, 237, .1); }
.progress-edit { min-width: 150px; color: var(--muted); font-weight: 700; }

.mini-list { display: grid; gap: 10px; }
.mini-list article { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mini-list span, .empty-state { color: var(--muted); }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-actions a { padding: 14px; border-radius: 14px; background: rgba(124, 58, 237, .1); color: var(--primary); font-weight: 700; }

.calendar-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month-grid div { min-height: 102px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.month-grid span { display: block; margin-top: 6px; padding: 5px 7px; border-radius: 8px; color: white; background: var(--primary); font-size: .72rem; }
.timetable { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.timetable > div { min-height: 240px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.timetable article { display: grid; gap: 4px; margin: 10px 0; padding: 12px; border-left: 5px solid var(--subject); border-radius: 12px; background: rgba(255, 255, 255, .32); }
.chart-panel { padding: 24px; }
.bars { display: flex; align-items: end; gap: 18px; height: 260px; }
.bars span { flex: 1; min-width: 32px; border-radius: 12px 12px 0 0; background: linear-gradient(180deg, var(--secondary), var(--primary)); position: relative; animation: grow .8s ease both; }
.bars b { position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: .8rem; }
.badges { display: flex; gap: 14px; margin-top: 44px; flex-wrap: wrap; }
.badges article { display: flex; align-items: center; gap: 10px; padding: 16px; font-weight: 700; }
.settings-list { display: grid; gap: 14px; }
.settings-list article { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px; }
.settings-list h3 { margin: 0 0 4px; }
.settings-list p { margin: 0; color: var(--muted); }
.file-btn { display: inline-grid; place-items: center; }
.file-btn input { display: none; }

.resource-stage { min-height: min(560px, calc(100vh - 150px)); display: grid; align-items: start; padding-top: clamp(18px, 8vh, 88px); }
.resource-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(18px, 4vw, 38px);
  max-width: 920px;
  padding: clamp(24px, 5vw, 46px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: var(--card);
  box-shadow: var(--shadow);
}
.resource-card::after { content: ""; position: absolute; right: -72px; bottom: -92px; width: 240px; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, rgba(124, 58, 237, .16), rgba(37, 99, 235, .04)); pointer-events: none; }
.resource-icon { position: relative; z-index: 1; display: grid; place-items: center; width: clamp(72px, 10vw, 104px); aspect-ratio: 1; border-radius: 28px; color: white; background: linear-gradient(145deg, var(--primary), var(--secondary)); box-shadow: 0 18px 36px rgba(37, 99, 235, .22); transform: rotate(-3deg); }
.resource-icon i { width: 42%; height: 42%; }
.resource-copy { position: relative; z-index: 1; }
.resource-copy h2 { max-width: 610px; margin: 8px 0 10px; font-size: clamp(1.45rem, 3vw, 2.45rem); line-height: 1.08; }
.resource-copy p:last-child { margin: 0; color: var(--muted); }
.resource-open { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 0 22px; border-radius: 15px; color: white; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 12px 25px rgba(37, 99, 235, .22); font-weight: 800; letter-spacing: .06em; transition: transform .2s ease, box-shadow .2s ease; }
.resource-open:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(37, 99, 235, .28); }
.resource-open:active { transform: translateY(0); }
.resource-open:focus-visible { outline: 3px solid rgba(124, 58, 237, .3); outline-offset: 4px; }

.bottom-nav, .fab { display: none; }
.toast { position: fixed; left: 50%; bottom: 92px; z-index: 20; transform: translateX(-50%); padding: 12px 16px; border-radius: 999px; color: white; background: #182033; box-shadow: var(--shadow); animation: fadeUp .25s ease both; }
.floating { animation: floatIn .65s ease both; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes grow { from { transform: scaleY(.15); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }

@media (max-width: 920px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { padding: 18px 14px 92px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .stat-grid, .content-grid, .project-grid, .calendar-layout, .timetable { grid-template-columns: 1fr; }
  .entry-form, .project-entry-form { grid-template-columns: 1fr; }
  .hero-panel { align-items: flex-start; flex-direction: column; }
  .goal-ring { width: 104px; }
  .month-grid { grid-template-columns: repeat(2, 1fr); }
  .task-card, .settings-list article { align-items: flex-start; flex-direction: column; }
  .resource-stage { min-height: auto; padding-top: 8px; }
  .resource-card { grid-template-columns: 1fr; align-items: start; }
  .resource-open { width: 100%; }
  .bottom-nav { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
  .bottom-nav a { display: grid; place-items: center; gap: 3px; color: var(--muted); font-size: .7rem; }
  .bottom-nav a:nth-child(n+6) { display: none; }
  .bottom-nav a.active { color: var(--primary); }
  .fab { position: fixed; right: 18px; bottom: 86px; z-index: 11; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; color: white; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: var(--shadow); }
}
