:root {
  --radius-lg: 12px;
  --radius-md: 8px;
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #6366f1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --grid-config: 20px 2.5fr 100px 180px 140px 140px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* --- Header & Layout (Restored Alignment) --- */
header {
  margin-bottom: 30px;
  padding: 0 10px;
}

.header-flex { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; /* Vertical alignment for brand and buttons */
}

header h1 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -1px;
}

.brand p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

/* --- Filters --- */
#filters {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding: 5px 0;
}

#filters button {
  padding: 6px 16px;
  border: 1px solid #e2e8f0;
  background: var(--bg-card);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

#filters button.active {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

/* --- COLUMN HEADERS --- */
.column-headers {
  display: grid;
  grid-template-columns: var(--grid-config);
  gap: 20px;
  padding: 12px 24px;
  align-items: center;
}

.column-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  justify-content: center;
  display: flex;
}

.column-headers div:nth-child(2) {
  justify-content: flex-start;
  text-align: left;
}

/* --- OBLIGATION CARDS --- */
.obligation {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: var(--grid-config);
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  transition: var(--transition);
  overflow: hidden;
  min-height: 75px;
  max-height: 75px; 
}

.obligation:hover {
  max-height: 800px;
  border-color: var(--accent);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08);
  padding-bottom: 24px;
}

/* --- HUMANIST CLARITY: SNOOZED STATE --- */
.obligation.is-snoozed {
  opacity: 0.6;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.obligation.is-snoozed:hover {
  opacity: 1;
  background: white;
  border-style: solid;
}

/* --- COMPLETED STATE (Done Tab) --- */
.obligation.is-completed {
  opacity: 0.6;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.obligation.is-completed:hover {
  opacity: 1;
  background: white;
  border-style: solid;
}

/* Done filter button styling */
#filters button.done-filter {
  border-color: #dcfce7;
  background: #f0fdf4;
}

#filters button.done-filter.active {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
}

/* Undo button for Done tab */
.btn-undo {
  background: white;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-undo:hover {
  border-color: #22c55e;
  color: #22c55e;
}

/* Completed date text styling */
.completed-text {
  font-size: 11px;
  font-weight: 700;
  color: #22c55e;
}

/* Animation when marking done */
@keyframes fadeOutRight {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(20px);
  }
}

.obligation.marking-done {
  animation: fadeOutRight 1s ease-out forwards;
  pointer-events: none;
}

/* Animation when undoing a done task */
@keyframes fadeOutLeft {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-20px);
  }
}

.obligation.marking-undone {
  animation: fadeOutLeft 1s ease-out forwards;
  pointer-events: none;
}

/* Animation when snoozing */
.obligation.marking-snoozed {
  animation: fadeOutRight 0.5s ease-out forwards;
  pointer-events: none;
}

/* --- GEOMETRIC STABILITY (Column Pinning) --- */
.type, .counterparty, .due-date-container {
  display: flex;
  flex-direction: column;
  align-items: center; 
  justify-content: center;
  width: 100%;
  text-align: center;
  height: 40px; 
  align-self: center; /* Pins them vertically during hover growth */
}

.type {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: capitalize;
  width: fit-content;
  height: auto;
  min-height: 22px;
  justify-self: center;
}

.counterparty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  height: auto;
}

/* --- CONTEXTUAL INTELLIGENCE: SNOOZE INFO --- */
.due-date-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.warning-text {
  font-size: 9px;
  font-weight: 900;
  color: #ef4444; /* Red for alert */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.resume-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent); /* Indigo for timeline */
}

/* --- PROOF / HIDDEN CONTENT --- */
.source-content {
  grid-column: 2 / 7;
  opacity: 0;
  visibility: hidden;
  padding-top: 20px;
  margin-top: 15px;
  border-top: 1px solid #f1f5f9;
  display: block;
}

.obligation:hover .source-content {
  opacity: 1;
  visibility: visible;
}

.obligation:hover .source-text {
  white-space: pre-wrap;
  overflow: visible;
  max-height: none;
}

.source-label {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
}

.source-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
}

/* --- UI ELEMENTS --- */
.prio-ring { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.prio-high { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }
.prio-med { background: #f59e0b; }
.prio-low { background: #94a3b8; }

.title-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  padding-right: 20px;
}

.title-stack h3 { 
  font-size: 14px; 
  font-weight: 700; 
  white-space: nowrap; 
  text-overflow: ellipsis; 
  overflow: hidden; 
  margin: 0; 
}

.evidence-quote {
  font-size: 10.5px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  border-left: 2px solid #e2e8f0;
  padding-left: 8px;
  opacity: 0.7;
  
  line-clamp: 1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;  
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
}

.obligation:hover .evidence-quote {
  line-clamp: unset;
  -webkit-line-clamp: unset;
  overflow: visible;
  color: var(--text-main);
}

.due-date { 
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.due-date.overdue { color: #ef4444; }

.actions { display: flex; gap: 8px; justify-content: flex-end; position: relative; }
.btn-done { background: var(--accent); color: white; border: none; padding: 6px 16px; border-radius: 20px; font-weight: 700; font-size: 12px; cursor: pointer; }

/* Wake button (Specifically for Snoozed Cards) */
.btn-wake {
  background: white;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
}
.btn-wake:hover { background: var(--accent); color: white; }

.btn-pause { background: white; color: var(--text-muted); border: 1px solid #e2e8f0; padding: 6px 12px; border-radius: 20px; cursor: pointer; }
.btn-pause:hover { border-color: var(--accent); color: var(--accent); }

/* --- MODALS & MENUS --- */
.snooze-wrapper { position: relative; }
.snooze-menu { display: none; position: absolute; top: 100%; right: 0; z-index: 100; background: white; border: 1px solid #e2e8f0; border-radius: var(--radius-md); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); min-width: 140px; margin-top: 5px; }
.snooze-menu.open { display: block; }
.snooze-menu button { display: block; width: 100%; padding: 8px 12px; border: none; background: none; text-align: left; font-size: 12px; cursor: pointer; }
.snooze-menu button:hover { background: #f8fafc; }

/* Modal Overlay */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}

.modal-content {
  background: white; padding: 24px; border-radius: 16px; width: 300px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); text-align: center;
}

.modal-content h4 { font-size: 14px; font-weight: 700; margin-bottom: 20px; color: var(--text-main); }

.modal-actions { display: flex; gap: 10px; justify-content: center; }

.btn-cancel {
  background: #f1f5f9; border: none; padding: 8px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text-muted);
}

.btn-confirm {
  background: #ef4444; border: none; padding: 8px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700; cursor: pointer; color: white;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:disabled {
  background: #fca5a5;
  cursor: not-allowed;
}

/* --- PRIVACY & DATA MODAL --- */
.privacy-modal-content {
  width: 400px;
  max-width: 90vw;
  text-align: left;
  padding: 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.privacy-section {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.privacy-section:last-child {
  border-bottom: none;
}

.privacy-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.data-summary {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.data-label {
  color: var(--text-muted);
}

.data-value {
  font-weight: 600;
  color: var(--text-main);
}

.btn-export {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-export:hover {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

.danger-zone {
  background: #fef2f2;
}

.danger-zone h4 {
  color: #991b1b;
}

.danger-text {
  font-size: 12px;
  color: #991b1b;
  line-height: 1.5;
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-main);
  margin-bottom: 16px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
}

.btn-delete-account {
  width: 100%;
  background: #dc2626;
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-delete-account:hover {
  background: #b91c1c;
}

.delete-confirm-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.delete-confirm-input:focus {
  outline: none;
  border-color: #dc2626;
}

/* --- CATEGORIES & ACCOUNT UI --- */
.type-payment { background: #fef2f2; color: #991b1b; }      
.type-deadline { background: #fffbeb; color: #92400e; }     
.type-appointment { background: #eff6ff; color: #1e40af; }  
.type-follow_up { background: #f5f3ff; color: #5b21b6; }    
.type-task { background: #f0fdf4; color: #166534; }         
.type-review { background: #f8fafc; color: #475569; }       

/* Dropdown */
.dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-accounts {
  background: white; border: 1px solid #e2e8f0; color: var(--text-main);
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px;
  cursor: pointer; transition: var(--transition); box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
/* --- SIGN OUT BUTTON FIX --- */
.btn-logout {
  background: white;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: white; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); min-width: 240px; z-index: 100;
  padding: 8px 0;
}

.dropdown-menu.open { display: block; }

.account-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; font-size: 12px; color: var(--text-main);
}

.account-item:hover { background: #f8fafc; }

.dropdown-divider { height: 1px; background: #f1f5f9; margin: 8px 0; }

.add-account-row {
  padding: 10px 16px; font-size: 12px; font-weight: 700; color: var(--accent);
  cursor: pointer; transition: background 0.2s;
}

.add-account-row:hover { background: #f8fafc; }

/* --- HAMBURGER MENU --- */
.hamburger-wrapper {
  position: relative;
}

.btn-hamburger {
  background: white;
  border: 1px solid #e2e8f0;
  color: var(--text-main);
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-hamburger:hover {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

.hamburger-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  min-width: 200px;
  z-index: 100;
  padding: 8px 0;
}

.hamburger-menu.open {
  display: block;
}

.hamburger-menu button,
.hamburger-menu a {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.hamburger-menu button:hover,
.hamburger-menu a:hover {
  background: #f8fafc;
}

/* --- ONBOARDING --- */
#landing-view {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg-app);
  padding: 20px;
}

.onboarding-card {
  background: var(--bg-card);
  padding: 48px;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 420px;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.05);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 40px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
  margin-bottom: 32px;
}

.feature-pillars { text-align: left; }
.pillar-item { 
  padding: 10px 16px; 
  border-left: 2px solid var(--accent); 
  margin-bottom: 12px; 
  background: #f8fafc; 
  border-radius: 0 8px 8px 0; 
}
.pillar-item h4 { font-size: 11px; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.pillar-item p { font-size: 12px; margin: 0; color: var(--text-muted); }

/* --- Date Group Headers --- */
.date-group-header {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 2px;
  margin: 32px 0 16px 10px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.date-group-header::after {
  content: "";
  height: 1px;
  background: linear-gradient(90deg, #e2e8f0 0%, transparent 100%);
  flex-grow: 1;
}

/* Ensure the first header doesn't have too much top margin */
#obligations .date-group-header:first-child {
  margin-top: 10px;
}

/* Surgical fix for account status dots */
.status-dot { 
  width: 6px; 
  height: 6px; 
  border-radius: 50%; 
  background: #22c55e; /* Success Green */
  flex-shrink: 0;
}

/* Fix for the account remove 'x' cursor */
.remove-account {
  cursor: pointer; /* Changes 'I' to 'Pointer' */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transition: background 0.2s;
}

.remove-account:hover {
  background-color: #fee2e2; /* Muted red background on hover */
  color: #ef4444; /* Brighter red 'x' on hover */
}

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

#refresh-icon {
  display: inline-block; /* Required for transform to work on inline elements */
}

#refresh-icon.spinning {
  animation: spin 1s linear infinite;
}

#refresh-btn.syncing {
  pointer-events: none; /* Prevents double-clicking while syncing */
  opacity: 0.6;
}

/* --- EMPTY STATE (Centered) --- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* --- LOADING STATE (matches .brand p styling, centered like empty-state) --- */
.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 12px;
}

/* --- SYNC ERROR STATE --- */
.sync-error {
  text-align: center;
  padding: 60px 20px;
}

.sync-error .error-message {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.sync-error .btn-retry {
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.sync-error .btn-retry:hover {
  background: var(--text-main);
  color: white;
  border-color: var(--text-main);
}

/* --- SKELETON LOADING CARDS --- */
.skeleton-container {
  margin-top: 10px;
}

.skeleton-card {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: var(--grid-config);
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
  min-height: 75px;
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
}

.skeleton-title-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-bar {
  height: 12px;
  border-radius: 6px;
  background: #e2e8f0;
}

.skeleton-bar.title { width: 70%; height: 14px; }
.skeleton-bar.subtitle { width: 90%; height: 10px; }
.skeleton-bar.type { width: 60px; height: 22px; }
.skeleton-bar.source { width: 80px; }
.skeleton-bar.date { width: 70px; }
.skeleton-bar.btn { width: 50px; height: 28px; border-radius: 20px; }

.skeleton-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.skeleton-message {
  text-align: center;
  margin-top: 30px;
  font-size: 12px;
  color: var(--text-muted);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}