/* ==========================================================================
   DonnaView — Design System v2
   Aesthetic: Warm Intelligence — editorial precision meets warm depth
   Fonts: Syne (display) + DM Sans (body)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── Tokens: Dark Mode (padrão) ─────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #0f0f12;
  --bg-elevated:    #16161b;
  --bg-sidebar:     #131317;
  --bg-card:        #1c1c23;
  --bg-hover:       #23232c;
  --bg-input:       rgba(255, 255, 255, 0.055);
  --bg-input-focus: rgba(255, 255, 255, 0.09);
  --bg-code:        #0b0b0e;

  /* Accent — amber/tangerine */
  --accent:         #f97316;
  --accent-hover:   #fb923c;
  --accent-muted:   rgba(249, 115, 22, 0.14);
  --accent-text:    #fb923c;

  /* Text */
  --text-primary:   #eceae2;
  --text-secondary: #8c8c9a;
  --text-muted:     #52525c;
  --text-code:      #dddad0;

  /* Borders */
  --border:         #252530;
  --border-strong:  #38384a;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.55);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg:  0 16px 48px rgba(0, 0, 0, 0.6);

  /* Scrollbar */
  --scrollbar-track: transparent;
  --scrollbar-thumb: #2e2e3a;
  --scrollbar-hover: #3e3e4e;

  /* Messages */
  --msg-user-bg:     #0f0f12;
  --msg-user-border: #222230;
  --msg-ai-bg:       #151519;
  --msg-ai-border:   #2b2b3a;
  --msg-sys-bg:      #17171e;
  --msg-tool-bg:     #17171e;

  /* Role icons */
  --icon-user:  #3b82f6;
  --icon-ai:    #f97316;
  --icon-sys:   #8b5cf6;
  --icon-tool:  #10b981;

  /* Status */
  --success-bg:   rgba(34, 197, 94, 0.12);
  --success-text: #4ade80;
  --error-bg:     rgba(248, 113, 113, 0.12);
  --error-text:   #f87171;

  /* Misc */
  --radius-sm:  5px;
  --radius-md:  10px;
  --radius-lg:  18px;
  --radius-xl:  26px;
  --t:          0.2s ease;
  --t-slow:     0.35s ease;

  /* Auth page overlay */
  --auth-glow: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(249,115,22,0.18) 0%, transparent 70%);
}

/* ── Tokens: Light Mode ─────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg-base:        #f4f2ed;
  --bg-elevated:    #ffffff;
  --bg-sidebar:     #ffffff;
  --bg-card:        #f9f8f5;
  --bg-hover:       #eceae3;
  --bg-input:       rgba(0, 0, 0, 0.05);
  --bg-input-focus: rgba(0, 0, 0, 0.08);
  --bg-code:        #1e1e28;

  --accent:         #c2410c;
  --accent-hover:   #ea580c;
  --accent-muted:   rgba(194, 65, 12, 0.09);
  --accent-text:    #c2410c;

  --text-primary:   #1a1a24;
  --text-secondary: #6c6c7c;
  --text-muted:     #a0a0b0;
  --text-code:      #dddad0;

  --border:         #e4e0d6;
  --border-strong:  #ccc8bc;

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg:  0 16px 48px rgba(0, 0, 0, 0.12);

  --scrollbar-track: transparent;
  --scrollbar-thumb: #d4cfc4;
  --scrollbar-hover: #bfb8ab;

  --msg-user-bg:     #f4f2ed;
  --msg-user-border: #e8e4da;
  --msg-ai-bg:       #ffffff;
  --msg-ai-border:   #e4e0d6;
  --msg-sys-bg:      #f0ede6;
  --msg-tool-bg:     #f0ede6;

  --icon-user:  #2563eb;
  --icon-ai:    #c2410c;
  --icon-sys:   #7c3aed;
  --icon-tool:  #059669;

  --success-bg:   rgba(22, 163, 74, 0.1);
  --success-text: #16a34a;
  --error-bg:     rgba(220, 38, 38, 0.09);
  --error-text:   #dc2626;

  --auth-glow: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(194,65,12,0.12) 0%, transparent 70%);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

/* Smooth theme transitions on key properties only */
body,
.sidebar,
header,
.date-filter,
.session-item,
.message,
.theme-toggle,
input,
button,
.auth-card,
.auth-wrapper {
  transition:
    background-color var(--t),
    border-color var(--t),
    color var(--t),
    box-shadow var(--t);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow: hidden;
}

/* ── Scrollbars ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ── App Shell ──────────────────────────────────────────────────────────── */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: var(--bg-base);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  height: 52px;
  flex-shrink: 0;
  z-index: 100;
}

.logo a {
  text-decoration: none;
}

.logo h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo h1 span {
  color: var(--accent-text);
}

/* Search */
.search {
  position: relative;
  flex: 1;
  max-width: 340px;
}

.search input {
  width: 100%;
  padding: 0.45rem 0.9rem 0.45rem 2.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  outline: none;
}

.search input:focus {
  border-color: var(--border-strong);
  background-color: var(--bg-input-focus);
}

.search input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.search-clear-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search i {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.78rem;
  pointer-events: none;
}

/* Header right group */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.user-greeting {
  white-space: nowrap;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.825rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
}

.logout-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent-text);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* Show/hide icons by theme */
.icon-sun  { display: none; }
.icon-moon { display: block; }

html[data-theme="light"] .icon-sun  { display: block; }
html[data-theme="light"] .icon-moon { display: none; }

/* ── Date Filter Bar ────────────────────────────────────────────────────── */
.date-filter {
  padding: 0.6rem 1.25rem;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.date-filter form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-group input[type="date"] {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  outline: none;
  color-scheme: inherit;
}

.filter-group input[type="date"]:focus {
  border-color: var(--accent);
}

.filter-button {
  padding: 0.38rem 0.9rem;
  background-color: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.filter-button:hover {
  background-color: var(--accent-hover);
}

.date-error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #e74c3c;
}

/* ── Main Layout ────────────────────────────────────────────────────────── */
main {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar h2 {
  padding: 0.75rem 1rem 0.65rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.session-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0.35rem 0;
}

.session-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 0.15rem 0.4rem;
  border-left: 2px solid transparent;
}

.session-item:hover {
  background-color: var(--bg-hover);
}

.session-item.active {
  background-color: var(--accent-muted);
  border-left-color: var(--accent);
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.session-id {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  font-family: 'DM Mono', 'Fira Code', monospace;
}

.session-item.active .session-id {
  color: var(--accent-text);
}

.message-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timestamp {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Content Area ───────────────────────────────────────────────────────── */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-base);
  min-width: 0;
}

.conversation-header {
  padding: 0.65rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-base);
  flex-shrink: 0;
}

.conversation-header h2 {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.02em;
}

.session-header-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.session-header-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.session-header-label {
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-right: 0.1rem;
}

.copy-session-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t), color var(--t), border-color var(--t);
}

.copy-session-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.copy-session-btn.copied {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: transparent;
}

.conversation-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 2rem;
}

/* ── Messages ───────────────────────────────────────────────────────────── */
.message {
  padding: 1.25rem 1.5rem 1.25rem 3.5rem;
  position: relative;
  animation: msgFadeIn 0.25s ease both;
  border-bottom: 1px solid transparent;
}

.message.user {
  background-color: var(--msg-user-bg);
  border-left: 2px solid var(--msg-user-border);
}

.message.assistant,
.message.apimessage {
  background-color: var(--msg-ai-bg);
  border-left: 2px solid var(--msg-ai-border);
}

.message.assistant .message-content::before,
.message.apimessage .message-content::before {
  /* Subtle AI indicator */
}

.message.system {
  background-color: var(--msg-sys-bg);
  border-left: 2px solid var(--icon-sys);
  border-left-opacity: 0.3;
  font-style: italic;
  color: var(--text-secondary);
}

.message.tool {
  background-color: var(--msg-tool-bg);
  border-left: 2px solid var(--msg-tool-bg);
}

/* Role icon (avatar) */
.role-container {
  position: absolute;
  left: 1rem;
  top: 1.25rem;
}

.role-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 0.78rem;
  color: #fff;
  flex-shrink: 0;
}

.message.user .role-icon       { background-color: var(--icon-user); }
.message.assistant .role-icon,
.message.apimessage .role-icon  { background-color: var(--icon-ai); }
.message.system .role-icon     { background-color: var(--icon-sys); }
.message.tool .role-icon       { background-color: var(--icon-tool); }

/* Role name */
.role-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}

.message.assistant .role-name,
.message.apimessage .role-name {
  color: var(--accent-text);
}

/* Timestamp */
.timestamp {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  text-align: right;
}

/* Message body */
.message-content {
  font-size: 0.925rem;
  line-height: 1.7;
  color: var(--text-primary);
  word-break: break-word;
}

.message.system .message-content {
  color: var(--text-secondary);
}

/* Markdown within messages */
.message-content p { margin-bottom: 0.75rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul,
.message-content ol { padding-left: 1.4rem; margin-bottom: 0.75rem; }
.message-content li { margin-bottom: 0.25rem; }
.message-content h1,
.message-content h2,
.message-content h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  margin: 1.2rem 0 0.5rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.message-content h1 { font-size: 1.3rem; }
.message-content h2 { font-size: 1.1rem; }
.message-content h3 { font-size: 0.975rem; }
.message-content strong { font-weight: 600; color: var(--text-primary); }
.message-content em { font-style: italic; color: var(--text-secondary); }
.message-content a { color: var(--accent-text); text-underline-offset: 3px; }
.message-content a:hover { color: var(--accent-hover); }
.message-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 0.75rem 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--accent-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.message-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* Inline code */
.message-content code {
  font-family: 'DM Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.84em;
  background: var(--bg-card);
  color: var(--accent-text);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Code blocks */
.message-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.message-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-code);
  font-size: 0.855rem;
  line-height: 1.65;
}

/* Tables */
.message-content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  width: 100%;
  margin: 0.75rem 0;
  font-size: 0.88rem;
}

.message-content th,
.message-content td {
  padding: 0.55rem 0.9rem;
  text-align: left;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.message-content th {
  background: var(--bg-card);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message-content tr:nth-child(even) td {
  background: var(--bg-card);
}

/* Tools badge */
.message-tools {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.message-tools::before {
  content: '\f0ad';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--icon-tool);
}

/* ── States ─────────────────────────────────────────────────────────────── */
.loading,
.error,
.no-messages,
.no-results {
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error { color: var(--error-text); }

/* Search highlight */
.search-highlight {
  background: rgba(249, 115, 22, 0.25);
  color: var(--accent-text);
  padding: 0 2px;
  border-radius: 3px;
}

/* ── Welcome screen ─────────────────────────────────────────────────────── */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 3rem;
  text-align: center;
  color: var(--text-secondary);
  gap: 1rem;
}

.welcome-icon {
  font-size: 2.5rem;
  color: var(--accent-text);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.welcome-message h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.welcome-message p {
  font-size: 0.925rem;
  max-width: 420px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Auth Pages (login, register, update_password) ──────────────────────── */
body.auth-page {
  overflow: auto;
  height: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-base);
}

body.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--auth-glow);
  pointer-events: none;
  z-index: 0;
}

.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

/* Floating theme toggle for auth pages */
.auth-theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
}

.auth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}

.auth-brand h1 span {
  color: var(--accent-text);
}

.auth-brand p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Auth forms */
.auth-form .form-group {
  margin-bottom: 1.1rem;
}

.auth-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.auth-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.925rem;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.auth-form input::placeholder {
  color: var(--text-muted);
}

.auth-submit {
  width: 100%;
  padding: 0.7rem;
  margin-top: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.auth-submit:hover {
  background: var(--accent-hover);
}

.auth-footer {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Alert messages */
.alert {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

html[data-theme="light"] .alert-error {
  border-color: rgba(220, 38, 38, 0.2);
}

html[data-theme="light"] .alert-success {
  border-color: rgba(22, 163, 74, 0.2);
}

/* Login info box (update_password success) */
.login-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.login-info p { margin-bottom: 0.35rem; }
.login-info p:last-child { margin-bottom: 0; }
.login-info strong { color: var(--accent-text); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  main { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: 38vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .search { max-width: 180px; }

  .user-greeting { display: none; }

  .auth-wrapper { padding: 1rem; }

  .auth-card { padding: 2rem 1.5rem; }
}

@media (max-width: 480px) {
  .date-filter form { flex-direction: column; align-items: flex-start; }
  .filter-group label { display: none; }
}
