body {
  margin: 0;
  padding: 0;
}

svg {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

.wrapper {
  max-width: 800px;
  margin: 40px;
  width: 100%;
}

/* Auth layout */
.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: hsl(48 33.3% 97.1% / 1);
}

/* Auth pages (sign in, sign up, forgot password) */
.auth-card {
  width: 100%;
  max-width: 400px;
  margin: 80px auto 0 auto;
  padding: 40px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-logo {
  font-weight: 700;
  font-size: 28px;
  background: linear-gradient(90deg, #6366f1, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 24px 0;
}

.auth-links {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-links .text-link {
  font-size: 14px;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-links .text-link:hover {
  color: #6366f1;
}
.sidebar-nav a.active {
  background-color: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}
.container {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #e8e8e8;
}

.profile-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #e8e8e8;
  background: #fff;
}

.nav-bar {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #e8e8e8;
}

/* sidebar + header */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: hsl(48 33.3% 97.1% / 1);
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: #1c1917;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.sidebar .sidebar-logo {
  padding: 20px;
  font-weight: 700;
  font-size: 24px;
  background: linear-gradient(90deg, #6366f1, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.sidebar-nav a {
  display: block;
  padding: 10px 20px;
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-footer {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.sidebar-nav ul,
.sidebar-footer ul {
  list-style: none;
  padding: 0;
}


.sidebar-footer li {
  margin-bottom: 10px;
}

.sidebar-footer a,
.sidebar-footer button {
  color: #fff
}

/* Main */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  height: 60px;
  background: #fdfbf7;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
  z-index: 10;
}

.header-center {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.app-logo {
  font-weight: 700;
  font-size: 28px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
}

.header-icon {
  cursor: pointer;
}

/* Content */
.app-content {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

/* Period selector */
.period-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.period-selector a {
  color: #44403c;
  text-decoration: none;
  font-size: 20px;
  padding: 4px 12px;
  transition: color 0.15s ease;
}

.period-selector a:hover {
  color: #6366f1;
}

.period-title {
  font-size: 18px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

/* Narrow centered page (profile, forms, etc.) */
.narrow-page {
  max-width: 480px;
  margin: 0 auto;
}

/* right-sidebar */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr clamp(280px, 19.4vw, 364px);
  gap: 24px;
  padding: 0 0;
}

.layout-main {
  min-width: 0; 
}

.layout-sidebar {
  position: relative;
}

.sidebar-card {
  position: sticky;
  top: 24px;
  padding: 24px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
}

.sidebar-title {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
}

/* Transactions header with tabs and month selector */
.section-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.sort-link {
  justify-self: end;
}

.section-nav--tags .title-lg {
  text-align: center;
}

.new-tag-link {
  display: none;
}

.period-buttons {
  justify-self: end;
  display: flex;
  gap: 0;
  background: #ece8e1;
  border-radius: 6px;
  padding: 2px;
}

.period-btn {
  padding: 6px 14px;
  border-radius: 4px;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  transition: all 0.2s;
  line-height: 1;
}

.period-btn:hover {
  color: #6366f1;
}

.period-btn.active {
  background: #374151;
  color: #fff;
}

.transaction-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
}

.tab-button {
  padding: 8px 26px;
  border-radius: 6px;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  background: #ece8e1;
  transition: all 0.2s;
  line-height: 1;
}

.tab-button:hover {
  color: #6366f1;
}

.tab-button.active {
  background: #374151;
  color: #fff;
}

/* Pie chart container */

.chart-container {
  border-radius: 16px;
  border: 1px solid #e8e8e8;
  padding-left: 8px;
  padding-bottom: 22px;
}

.pie-chart-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

.pie-chart-container.bar-mode {
  max-width: 800px;
  margin-bottom: 23px;
}

.chart-type-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 18px;
  background: #ece8e1;
  border-radius: 6px;
  padding: 2px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.chart-type-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: #ece8e1;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.chart-type-btn:hover {
  color: #374151;
}

.chart-type-btn.active {
  background: #374151;
  color: #fff;
}

/* Pagination - sticky to keep it in same place on screen */
.pagination-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 16px;
  padding: 24px;
  border-radius: 8px;
  z-index: 10;
}

/* Pagy navigation */
.pagination-wrapper nav.pagy {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

nav.pagy {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* All links (pages and arrows) */
nav.pagy a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #374151;
  background: #f3f4f6;
  transition: all 0.2s;
  min-width: 40px;
  text-align: center;
}

/* Hover effect */
nav.pagy a:hover {
  background: #e5e7eb;
  color: #44403c;
}

/* Current/active page */
nav.pagy a.current {
  background: #111827;
  color: #fff;
  font-weight: 600;
  pointer-events: none;
}

/* Disabled links (prev/next when on first/last page) */
nav.pagy a[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* User Menu Dropdown (TODO: move to components.css later) */
.user-menu {
  position: relative;
}

.user-avatar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-avatar:hover {
  background: #ece8e1;
}

.dropdown-arrow {
  font-size: 10px;
  opacity: 0.7;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 12px 16px;
  font-size: 13px;
  color: #6b7280;
  word-break: break-all;
}

.dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  text-decoration: none;
  color: #374151;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-logout {
  color: #dc2626;
  font-weight: 500;
}

.dropdown-logout:hover {
  background: #fef2f2;
}