:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --danger: #dc2626;
  --shadow: 0 8px 30px rgba(15, 23, 42, .08);

  /* Sidebar colors */
  --sidebar-bg: #1a2744;
  --sidebar-dark: #0f172a;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-active: rgba(96, 165, 250, 0.2);
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --topbar-height: 50px;
}

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

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ===== APP LAYOUT ===== */
.app-body {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-dark) 100%);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.3s ease;
  overflow: hidden;
}

.app-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--topbar-height);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  background: white;
  padding: 3px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.logo-highlight {
  color: #60a5fa;
}

.app-sidebar.collapsed .sidebar-logo-text {
  display: none;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar.collapsed .nav-text {
  display: none;
}

.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== NAV-GROUP (Collapsible Menus) ===== */
.nav-group {
  margin: 4px 0;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-group-toggle:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.nav-group.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-group.open>.nav-group-items {
  max-height: 400px;
}

.nav-sub-item {
  padding-left: 44px !important;
  font-size: 13px;
}

/* Nested nav-group (e.g. Depozit inside Gestiune) */
.nav-nested-group {
  margin: 0;
}

.nav-sub-toggle {
  padding-left: 44px !important;
  font-size: 13px;
}

.nav-nested-item {
  padding-left: 60px !important;
}

.app-sidebar.collapsed .nav-group-toggle {
  justify-content: center;
  padding: 10px;
}

.app-sidebar.collapsed .nav-chevron,
.app-sidebar.collapsed .nav-group-toggle .nav-text {
  display: none;
}

.app-sidebar.collapsed .nav-group-items {
  display: none;
}

/* ===== MAIN CONTENT AREA ===== */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
  min-width: 0; /* Critical for flex overflow containment */
}

.app-main.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ===== TOP BAR ===== */
.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
  color: var(--text);
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0081e7 0%, #00408c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-name {
  font-weight: 500;
  color: var(--text);
  font-size: 14px;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #fee2e2;
  color: var(--danger);
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

/* ===== APP CONTENT ===== */
.app-content {
  flex: 1;
  padding: 20px 24px;
  background: var(--bg);
  min-width: 0; /* Prevents children from expanding parent */
  overflow-x: hidden; /* Contains any remaining overflows */
}

/* ===== WIDGETS GRID ===== */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.widget {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.widget-header-blue {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.widget-header-pink {
  background: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
}

.widget-header-dark {
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
}

.widget-header-teal {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
}

.widget-title {
  font-weight: 600;
}

.widget-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.widget-body {
  padding: 20px;
}

/* Welcome Widget */
.welcome-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.welcome-content .highlight {
  color: var(--primary);
}

.welcome-date {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.welcome-time {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Inter', monospace;
}

/* Quick Actions Widget */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  background: #fff;
}

.quick-action-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.quick-action-btn span {
  font-size: 13px;
  font-weight: 500;
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-icon svg {
  width: 22px;
  height: 22px;
}

.action-icon-blue {
  background: #dbeafe;
  color: #2563eb;
}

.action-icon-green {
  background: #dcfce7;
  color: #16a34a;
}

.action-icon-orange {
  background: #fef3c7;
  color: #d97706;
}

/* Stats Widget */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon-small {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-small svg {
  width: 20px;
  height: 20px;
}

.stat-blue {
  background: #dbeafe;
  color: #2563eb;
}

.stat-green {
  background: #dcfce7;
  color: #16a34a;
}

.stat-orange {
  background: #fef3c7;
  color: #d97706;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Info Widget */
.info-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-item {
  display: flex;
  gap: 12px;
}

.info-icon {
  font-size: 24px;
  line-height: 1;
}

.info-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.info-text p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* ===== PLANNER SPECIFIC ===== */
.planner-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.controls-left,
.controls-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.planner-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

@media (max-width: 1100px) {
  .planner-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btnPrimary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btnPrimary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btnDanger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btnDanger:hover {
  background: #b91c1c;
}

.yearBox {
  min-width: 80px;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}

/* ===== CALENDAR ===== */
.calendarWrap {
  min-width: 0;
}

.yearGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 14px;
}

@media (max-width: 1400px) {
  .yearGrid {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
  }
}

@media (max-width: 1000px) {
  .yearGrid {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
}

@media (max-width: 700px) {
  .yearGrid {
    grid-template-columns: 1fr;
  }
}

.month {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.monthHeader {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 10px 12px;
  font-weight: 600;
  text-align: center;
  font-size: 14px;
}

.dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 10px;
  background: #3b82f6;
  color: rgba(255, 255, 255, 0.95);
  font-size: 11px;
  text-align: center;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px;
  gap: 4px;
}

.day {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  position: relative;
  transition: all 0.15s ease;
}

.day.empty {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.day:hover:not(.empty) {
  background: #f1f5f9;
}

.day.selected {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.day.today:not(.empty) {
  border-color: var(--primary);
  font-weight: 600;
}

.day.hasDoneAll {
  background: #dcfce7;
  border-color: #16a34a;
}

.day.hasPending {
  background: #ffedd5;
  border-color: #f97316;
}

/* ===== PANEL ===== */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 16px;
  overflow: auto;
}

.panelHeader {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panelHeader h2 {
  margin: 0;
  font-size: 16px;
}

.panelMeta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.tasksList {
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.taskCard {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.taskTop {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.taskTitle {
  font-weight: 600;
  font-size: 14px;
  margin: 0;
}

.taskDesc {
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  margin: 0;
}

.taskMeta {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.badge.done {
  border-color: #16a34a;
  color: #16a34a;
  background: #f0fdf4;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  padding: 14px 2px;
}

/* ===== MODALS ===== */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 2000;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  z-index: 2001;
  padding: 16px;
}

.modalWide {
  width: min(900px, calc(100vw - 32px));
}

.hidden {
  display: none !important;
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modalHeader h3 {
  margin: 0;
  font-size: 16px;
}

.form {
  padding-top: 12px;
  display: grid;
  gap: 12px;
}

.formRow {
  display: grid;
  gap: 6px;
}

.formRow label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.split {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  user-select: none;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.modalActions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}

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

/* Pending Split */
.pendingSplit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-height: calc(100vh - 280px);
  overflow: hidden;
}

.pendingSplit>div {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#pendingList,
#notesList {
  overflow: auto;
  min-height: 0;
  max-height: 100%;
  padding-right: 6px;
}

.splitTitle {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.splitTitleRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .pendingSplit {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 320px);
  }

  #pendingList,
  #notesList {
    max-height: 40vh;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0 !important;
    width: 100%;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .user-name {
    display: none;
  }

  .widgets-grid {
    grid-template-columns: 1fr;
  }

  .planner-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls-left,
  .controls-center {
    justify-content: center;
  }
}

/* ===== NOTES PAGE ===== */
.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.notes-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.note-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.note-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.note-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.note-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex: 1;
}

.note-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-icon-danger:hover {
  background: #fee2e2;
  color: var(--danger);
  border-color: var(--danger);
}

.note-content {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 12px 0;
  white-space: pre-wrap;
  line-height: 1.6;
  max-height: 120px;
  overflow: hidden;
}

.note-meta {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ===== COMPLETED TASKS PAGE ===== */
.completed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.completed-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.date-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-picker-wrap label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.date-input {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  min-width: 160px;
}

.completed-tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.completed-task-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #16a34a;
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.task-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex: 1;
}

.task-card-desc {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 10px 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.task-card-notes {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px 0;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 6px;
}

.task-card-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

/* ===== SEARCHABLE CLIENT DROPDOWN ===== */
.client-autocomplete {
  position: relative;
}

.client-autocomplete input {
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-dropdown.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: #f1f5f9;
}

.autocomplete-item.selected {
  background: #dbeafe;
  color: var(--primary);
}

.autocomplete-empty {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ===== SCADENTE PAGE ===== */
.scadente-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.scadente-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.scadente-actions {
  display: flex;
  gap: 10px;
}

.search-bar {
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 129, 231, 0.1);
}

.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.provider-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 4px solid var(--primary);
}

.provider-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.provider-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.provider-code {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

.provider-sold {
  font-size: 14px;
  font-weight: 600;
}

.sold-positive {
  color: #dc2626;
}

.sold-zero {
  color: #16a34a;
}

.provider-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.provider-modal-content {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

.provider-info-section h3,
.invoices-header h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.invoices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.invoices-actions {
  display: flex;
  gap: 8px;
}

.invoices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.invoices-table th,
.invoices-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.invoices-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.invoices-table tr.overdue {
  background: #fef2f2;
}

.invoices-table tr.overdue td {
  color: #dc2626;
}

.modalWide {
  max-width: 900px;
  width: 95%;
}

@media (max-width: 768px) {
  .provider-modal-content {
    grid-template-columns: 1fr;
  }
}

/* ===== OLD TOPBAR STYLES FOR COMPATIBILITY ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #0081e7;
  position: sticky;
  top: 0;
  z-index: 5;
}

.title h1 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}

.subtitle {
  color: #fff;
  font-size: 13px;
  margin-top: 2px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== PRINT ===== */
@media print {
  body {
    background: #fff;
  }

  .app-sidebar,
  .app-topbar,
  .planner-controls {
    display: none;
  }

  .app-main {
    margin-left: 0;
  }
}

/* ===== NOTIFICATIONS ===== */
.notification-wrapper {
  position: relative;
}

.notification-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}

.notification-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.notification-btn svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 340px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-header {
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.notification-list {
  max-height: 320px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}

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

.notification-item:last-child {
  border-bottom: none;
}

.notification-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.notification-icon.warning {
  background: #fef3c7;
  color: #d97706;
}

.notification-icon.danger {
  background: #fee2e2;
  color: #dc2626;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 2px;
}

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

.notification-empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}