:root {
  --brand: #111827;
  --accent: #0ea5e9;
  --muted: #6b7280;
  --card: #ffffff;
  --ring: rgba(14, 165, 233, 0.25);
  --bg: #fff;
  --border: #e5e7eb;
  --topbar-h: 60px;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #fff;
  color: var(--brand);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  scroll-behavior: smooth;

  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: calc(var(--topbar-h) + 16px) 0 64px;
}

button, .btn, .icon-btn {
  color: var(--btn-fg, #0f172a);
  background: var(--btn-bg, #ffffff);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.brand-logo-icon {
  color: var(--brand);
  display: inline-block;
  vertical-align: middle;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #eef2f7;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.brand a {
  display: inline-block;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--brand);
  border-radius: 10px;
}

.nav-links {
  display: none;
  gap: 14px;
  align-items: center;
}

.nav-links a {
  display: inline-block;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--brand);
  border-radius: 10px;
  font-weight: 600;
}

.nav-links a.active {
  color: var(--accent);
  background: rgba(14, 165, 233, 0.08);
}

.nav-links a:hover {
  background: rgba(0, 0, 0, 0.04);
}

.menu-btn {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.menu-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.menu-icon {
  width: 22px;
  height: 2px;
  background: var(--brand);
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
}

.menu-icon::before {
  top: -7px;
}

.menu-icon::after {
  top: 7px;
}

.drawer {
  position: fixed;
  inset: var(--topbar-h) 0 auto 0;
  background: #fff;
  border-bottom: 1px solid #eef2f7;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer .container {
  padding: 12px 16px;
}

.drawer a {
  display: block;
  padding: 12px;
  text-decoration: none;
  color: var(--brand);
  border-radius: 8px;
  font-weight: 600;
}

.drawer a:hover {
  background: rgba(0, 0, 0, 0.04);
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(28px, 6vw, 48px);
}

h2 {
  font-size: clamp(22px, 4.5vw, 36px);
}

p.lead {
  margin: 6px 0 0;
  color: var(--muted)
}

.page-header {
  margin: 0 0 1rem;
}

.page-header h1 {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: .9rem;
  border-radius: .5rem;
  padding: .5rem .9rem;
  font-weight: 700;
  transition: transform .06s ease, box-shadow .2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px var(--ring);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px var(--ring);
}

.btn-outline {
  background: #fff;
  color: var(--brand);
  border-color: #e5e7eb;
}

.btn-outline:hover {
  background: #f8fafc;
}

.btn-danger {
  background: #fff;
  border-color: #fecaca;
  color: #b91c1c;
}

.hidden {
  display: none;
}

.small {
  font-size: 12px;
  color: var(--muted)
}

.muted {
  color: var(--muted)
}

footer {
  border-top: 1px solid #eef2f7;
  padding: 28px 0;
  margin-top: auto;
}

footer .mini {
  color: var(--muted);
  font-size: 14px;
}

.footer-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.footer-flex .links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-flex .links a:hover {
  text-decoration: underline;
  color: var(--brand);
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
}

.user-btn:hover,
.user-btn:focus {
  background: var(--ring, rgba(14,165,233,0.08));
  outline: none;
}

.user-icon {
  font-size: 1.2rem;
}

.user-dropdown {
  position: absolute;
  top: 100%; 
  right: 0;
  margin-top: 0;
  padding-top: .5rem;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: .5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  display: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 1000;
}

.user-dropdown a {
  display: block;
  padding: .6rem 1rem;
  text-decoration: none;
  color: var(--brand, #111827);
  white-space: nowrap;
}

.user-dropdown a:hover {
  background: var(--accent, #0ea5e9);
  color: #fff;
}

.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown,
.user-menu.open .user-dropdown {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.user-menu::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px; 
}

.user-menu--desktop-only { 
  display: none !important; 
}

.login-btn--desktop { 
  display: none; 
}

.drawer-user{
  display:flex;
  align-items:center;
  gap:.6rem;
  padding:8px 12px 14px;
}
.drawer-user .avatar{
  width:28px; height:28px; display:inline-grid; place-items:center;
  border-radius:8px;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  box-shadow: 0 6px 16px rgba(14,165,233,.25);
  font-size: 16px;
}
.drawer-user .name{
  font-weight:800;
  letter-spacing:.2px;
}

.drawer .divider{
  height: 1px;
  border: 0;
  margin: 8px 0 12px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(0,0,0,.08) 10%,
    rgba(0,0,0,.12) 50%,
    rgba(0,0,0,.08) 90%,
    transparent 100%
  );
}

.actions-top {
  display:flex;
  justify-content:flex-end;
  align-items:center;
  margin:.75rem 0 1rem;
}

.btn-new{display:inline-flex;gap:.5rem;align-items:center;background:var(--accent);color:#fff;
  border:none;border-radius:.5rem;padding:.5rem .9rem;text-decoration:none;font-weight:600;cursor:pointer;}
.btn-new:hover{filter:brightness(.95);}

button:disabled, .disabled { 
  opacity:.6; 
  cursor:not-allowed; 
}

button, .btn, .icon-btn {
  color: var(--btn-fg, #0f172a);
  background: var(--btn-bg, #ffffff);
}

a[aria-disabled="true"] {
  pointer-events: none;
  opacity: .6;
  cursor: not-allowed;
}

@media (max-width: 640px){
  .actions-top{justify-content:stretch;}
  .btn-new{display:block;width:100%;text-align:center;}
}

@media (min-width: 768px) {
  :root {
    --topbar-h: 72px;
  }

  .nav {
    height: 72px;
  }

  .menu-btn {
    display: none;
  }

  .nav-links {
    display: flex;
  }

  .drawer {
    display: none !important;
  }

  .login-btn--desktop { 
    display: inline-flex; 
  }

  .user-menu--desktop-only { 
    display: inline-block !important; 
  }
}

.alert {
  position: relative;
  padding: 12px 40px 12px 14px;
  border: 1px solid transparent;
  border-radius: .5rem;
  margin: 10px 0;
  font-size: 0.95rem;
  line-height: 1.4rem;
  display: flex;
  align-items: center;
}

.alert-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
}
.alert-close:hover {
  opacity: 1;
}

.alert-success {
  background-color: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.alert-info {
  background-color: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}
.alert-warning {
  background-color: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.alert-error,
.alert-danger {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.messages .alert{
  position: relative;
  display: flex;
  align-items: start;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 40px 12px 14px;
  border: 1px solid transparent;
  border-radius: .5rem;
  font-size: .95rem;
  line-height: 1.4rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: opacity .25s ease, transform .25s ease;
  transform: translateZ(0);
  background-clip: padding-box;
}

.messages .alert .alert-text{ flex: 1; }

.messages .alert .alert-close{
  position: absolute;
  top: 8px; right: 10px;
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  opacity: .6;
}
.messages .alert .alert-close:hover{ opacity: 1; }

.messages .alert-success{
  background-color: #ecfdf5; 
  border-color:     #6ee7b7;
  color:            #065f46;
}
.messages .alert-info{
  background-color: #eff6ff;
  border-color:     #93c5fd;
  color:            #1e3a8a;
}
.messages .alert-warning{
  background-color: #fffbeb;  
  border-color:     #fcd34d;
  color:            #92400e;
}
.messages .alert-error,
.messages .alert-danger{
  background-color: #fef2f2;
  border-color:     #fecaca;
  color:            #b91c1c;
}

.messages .alert.is-closing{
  opacity: 0;
  transform: translateY(-4px);
}

.grid-2, .grid-3 { 
  display: grid; 
  gap: 14px; 
  grid-template-columns: 1fr; 
}

@media (min-width: 768px) { 
  .grid-2 { 
    grid-template-columns: repeat(2, minmax(0, 1fr));
  } 

  .grid-3 { 
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.grid-2 > *, .grid-3 > *,
.card, .radio-card { min-width: 0; }