/* Search on every page — compact, inline with title */
.page-search-bar {
  flex: 1;
  min-width: 140px;
  max-width: 260px;
  margin-left: auto;
}

.page-header.has-search {
  align-items: center;
}

.greeting.has-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.greeting-text {
  min-width: 0;
}

.page-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-mute);
}

.page-search svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}

.page-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
}

.page-search input::placeholder {
  color: var(--text-mute);
}

/* Mails page */
.mail-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.mail-list-panel,
.mail-reading-panel {
  min-height: 0;
}

.mail-item.is-selected {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.35);
}

.mail-reading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.mail-reading-from {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mail-reading-from strong {
  display: block;
  font-size: 0.95rem;
}

.mail-reading-from span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-mute);
}

.mail-reading-meta {
  margin-bottom: 14px;
  flex-shrink: 0;
}

.mail-reading-meta h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.mail-reading-meta time {
  font-size: 0.78rem;
  color: var(--text-mute);
}

.mail-reading-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.mail-reading-body p {
  margin: 0 0 12px;
}

.mail-reading-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-shrink: 0;
}

/* Shared page layout */
.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.page-tabs {
  flex-shrink: 0;
}

.page-panel {
  flex: 1;
  min-height: 0;
}

.page-list {
  overflow: auto;
}

.page-grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.page-stats {
  grid-template-columns: repeat(3, 1fr);
  flex-shrink: 0;
}

.page-stats .stat-card {
  min-height: auto;
  padding: 16px;
}

.page-stats .stat-value {
  font-size: 1.45rem;
  margin: 6px 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

/* Calendar (legacy compact grid kept for other pages) */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-grid > span {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-mute);
  padding-bottom: 6px;
}

.calendar-grid > button {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: default;
  font-size: 0.85rem;
}

.calendar-grid > button.is-today {
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.35), rgba(236, 72, 153, 0.25));
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
}

/* Calendar page — month + day panel */
.calendar-page {
  min-height: 0;
}

.calendar-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  align-items: stretch;
}

.calendar-month-panel,
.calendar-day-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.calendar-month-panel .panel-head,
.calendar-day-panel .panel-head {
  flex-shrink: 0;
}

.calendar-month-panel .panel-head h2 {
  text-transform: capitalize;
}

.btn-ghost.tiny {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 10px;
}

.cal-month {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.cal-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  padding: 2px 0 4px;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(88px, 1fr);
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 88px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cal-day:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

.cal-day.is-empty {
  visibility: hidden;
  pointer-events: none;
  border: none;
  background: transparent;
  min-height: 0;
}

.cal-day.is-today {
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.2);
}

.cal-day.is-selected {
  background: linear-gradient(160deg, rgba(168, 85, 247, 0.22), rgba(59, 130, 246, 0.1));
  border-color: rgba(168, 85, 247, 0.5);
}

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1;
  color: var(--text-soft);
  padding: 1px 2px;
}

.cal-day.is-today .cal-day-num,
.cal-day.is-selected .cal-day-num {
  color: var(--text);
}

.cal-day-chips {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  overflow: hidden;
}

.cal-chip {
  display: block;
  width: 100%;
  border: none;
  border-radius: 7px;
  padding: 3px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: #fff;
}

.cal-chip.purple {
  background: rgba(168, 85, 247, 0.55);
}

.cal-chip.blue {
  background: rgba(59, 130, 246, 0.55);
}

.cal-chip.teal {
  background: rgba(20, 184, 166, 0.55);
}

.cal-chip.pink {
  background: rgba(236, 72, 153, 0.55);
}

.cal-chip-more {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  font-weight: 600;
}

.calendar-agenda {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.calendar-agenda-item {
  grid-template-columns: 1fr;
}

.calendar-agenda .agenda-bar {
  text-decoration: none;
  transition: filter 0.15s ease;
}

.calendar-agenda .agenda-bar:hover {
  filter: brightness(1.08);
}

.calendar-agenda .agenda-item.is-done .agenda-bar {
  opacity: 0.65;
}

.calendar-agenda .agenda-bar.teal {
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.35), rgba(20, 184, 166, 0.12));
  border-color: rgba(20, 184, 166, 0.28);
  box-shadow: inset 3px 0 0 #14b8a6;
}

.calendar-day-panel .tasks-empty {
  margin: 8px 0 0;
}

.calendar-day-panel .panel-head {
  align-items: center;
  gap: 10px;
}

.calendar-day-panel .panel-head .btn-ghost.tiny {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.calendar-day-panel .panel-head .btn-ghost.tiny svg {
  width: 14px;
  height: 14px;
}

.cal-empty-add {
  display: inline;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: none;
  color: #c4b5fd;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cal-empty-add:hover {
  color: #ddd6fe;
}

/* Clients page */
.clients-page .client-item {
  grid-template-columns: 36px 1fr auto auto;
}

.client-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.client-meta[role="button"] {
  cursor: pointer;
}

.client-form-panel {
  width: min(720px, 100%);
}

.client-lookup-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: rgba(168, 85, 247, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-lookup-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.client-lookup-head strong {
  font-size: 0.92rem;
}

.client-lookup-head span {
  font-size: 0.75rem;
  color: var(--text-mute);
}

.client-lookup-actions {
  justify-content: flex-end;
}

.client-lookup-actions .btn-ghost {
  width: 100%;
  justify-content: center;
}

.client-lookup-msg {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.35;
}

.client-lookup-msg.is-error {
  color: #fecaca;
}

.client-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.client-form-grid .task-field-wide {
  grid-column: 1 / -1;
}

.client-peppol-block {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.03);
}

.client-peppol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.client-peppol-badge {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
}

.client-peppol-badge.is-found {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.client-peppol-badge.is-missing {
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 720px) {
  .client-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Projects */
.project-card h3 {
  margin: 10px 0 6px;
  font-size: 1.05rem;
}

.project-card > p {
  margin: 0 0 14px;
  color: var(--text-mute);
  font-size: 0.84rem;
  line-height: 1.4;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7, #ec4899);
}

.progress-bar.blue {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.progress-bar.teal {
  background: linear-gradient(90deg, #14b8a6, #2dd4bf);
}

.progress-bar.pink {
  background: linear-gradient(90deg, #ec4899, #f472b6);
}

.project-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.tag.teal {
  color: #99f6e4;
  background: rgba(20, 184, 166, 0.2);
}

.tag.pink {
  color: #fbcfe8;
  background: rgba(236, 72, 153, 0.2);
}

/* Invoices */
.invoice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invoice-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.invoice-item div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.invoice-item strong {
  font-size: 0.9rem;
}

.invoice-item span {
  font-size: 0.75rem;
  color: var(--text-mute);
}

/* Notes */
.note-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

.note-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

.note-icon svg {
  width: 18px;
  height: 18px;
  color: white;
}

.note-icon.purple { background: rgba(168, 85, 247, 0.25); }
.note-icon.blue { background: rgba(59, 130, 246, 0.25); }
.note-icon.pink { background: rgba(236, 72, 153, 0.25); }
.note-icon.teal { background: rgba(20, 184, 166, 0.25); }

.note-body strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.note-body > span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-mute);
  margin-bottom: 8px;
}

.note-body p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* Reports */
.chart-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  height: 180px;
  padding-top: 10px;
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.chart-col span {
  width: 100%;
  max-width: 28px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #c084fc, #7c3aed);
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.25);
}

.chart-col small {
  color: var(--text-mute);
  font-size: 0.72rem;
}

.report-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.report-list span {
  color: var(--text-soft);
}

/* Settings — compact & editable */
.settings-page {
  gap: 10px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.settings-grid {
  align-content: start;
  gap: 10px;
}

.settings-card {
  padding: 12px 14px;
  min-height: 0;
  height: fit-content;
}

.settings-card .panel-head {
  margin-bottom: 8px;
}

.settings-card .panel-head h2 {
  font-size: 0.95rem;
}

.settings-card-wide {
  grid-column: 1 / -1;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-field-stack {
  grid-template-columns: 1fr;
  gap: 5px;
  padding: 8px 10px;
}

.settings-field > span {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 500;
}

.settings-field input,
.settings-field select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(20, 16, 40, 0.85);
  color: #f8fafc;
  border-radius: 8px;
  padding: 9px 10px;
  outline: none;
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.3;
  color-scheme: dark;
}

.settings-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-color: rgba(20, 16, 40, 0.85);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(226,232,240,0.75)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.settings-field input:focus,
.settings-field select:focus {
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.12);
}

.settings-field input[readonly] {
  opacity: 0.7;
  cursor: default;
}

.settings-field select option {
  background: #1a1630;
  color: #f1f5f9;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.settings-actions .btn-primary {
  border: none;
  cursor: pointer;
}

.settings-status {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  flex-shrink: 0;
}

.settings-status.is-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.settings-status.is-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

@media (max-width: 1100px) {
  .settings-field:not(.settings-field-stack) {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

#app.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost svg {
  width: 16px;
  height: 16px;
}

/* Organisation */
.org-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.org-status {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
}

.org-status.is-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.org-status.is-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.org-top-grid,
.org-invite-grid,
.org-roles-grid {
  align-items: stretch;
}

.org-card {
  padding: 16px 18px;
  min-height: 0;
}

.org-card-wide {
  grid-column: 1 / -1;
}

.org-help {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.org-help a {
  color: inherit;
}

.org-inline-form {
  display: grid;
  gap: 12px;
}

.org-active-row {
  display: grid;
  gap: 10px;
}

.org-active-meta {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.org-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.org-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.org-tab {
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}

.org-tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.org-table-wrap {
  overflow: auto;
  max-height: min(42vh, 360px);
}

.org-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.org-table th,
.org-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.org-table th {
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.78rem;
}

.org-table select {
  max-width: 160px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding: 0 28px 0 10px;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(226,232,240,0.75)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

.org-table select option {
  background: #1a1630;
  color: #f1f5f9;
}

.org-actions {
  text-align: right;
  white-space: nowrap;
}

.org-danger {
  color: #fecaca !important;
}

.org-code-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.org-code-row code {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  letter-spacing: 0.04em;
  font-size: 0.95rem;
}

.org-invite-link {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-soft);
  word-break: break-all;
}

.org-role-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: min(42vh, 360px);
  overflow: auto;
}

.org-role-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  font: inherit;
}

.org-role-item span {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.org-role-form {
  display: grid;
  gap: 12px;
}

.org-perm-fieldset {
  border: 1px solid var(--glass-border-soft);
  border-radius: 14px;
  padding: 10px 12px 12px;
  margin: 0;
}

.org-perm-fieldset legend {
  padding: 0 6px;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.org-perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  max-height: min(28vh, 220px);
  overflow: auto;
}

.org-perm {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.org-role-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.org-empty {
  padding: 18px;
  color: var(--text-soft);
}

.org-empty a {
  color: inherit;
}

/* Tâches / Projets */
.tasks-status {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  margin-bottom: 10px;
}

.tasks-status.is-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.tasks-status.is-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.app-modal[hidden] {
  display: none !important;
}

.app-modal:not([hidden]) {
  display: grid;
}

.app-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 20, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.app-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  margin: 0;
  padding: 20px 22px 16px;
  border-radius: 22px;
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.app-modal.is-open .app-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.task-create-panel {
  margin-bottom: 0;
  gap: 0;
}

.task-modal-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.task-modal-head h2 {
  font-size: 1.15rem;
}

.task-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px 22px;
  align-items: start;
}

.task-modal-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.task-modal-side {
  min-width: 0;
}

.task-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.task-field-row:has(#task-assignee-wrap[hidden]) {
  grid-template-columns: 1fr;
}

.task-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.task-field > span {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 500;
}

.task-field input,
.task-field select,
.task-field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 10, 28, 0.55);
  color: #f8fafc;
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
  font: inherit;
  font-size: 0.86rem;
  color-scheme: dark;
}

.task-field textarea {
  resize: vertical;
  min-height: 78px;
  line-height: 1.4;
}

.task-field input:focus,
.task-field select:focus,
.task-field textarea:focus {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

.task-field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(226,232,240,0.75)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.task-create-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.task-desc {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.task-main[data-task-edit] {
  cursor: pointer;
}

.task-cal-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(12, 10, 28, 0.35));
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-cal-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-cal-card-head strong {
  font-size: 0.86rem;
  font-weight: 600;
}

.task-cal-card-head span {
  font-size: 0.72rem;
  color: var(--text-soft);
}

.task-cal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.task-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  max-width: 212px;
}

.task-cal-nav strong {
  font-size: 0.78rem;
  text-transform: capitalize;
  font-weight: 600;
}

.task-cal-nav-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.task-cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.task-cal-weekdays,
.task-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 26px);
  gap: 4px;
  justify-content: center;
}

.task-cal-weekdays span {
  text-align: center;
  font-size: 0.62rem;
  color: var(--text-soft);
  line-height: 18px;
  font-weight: 500;
}

.task-cal-day {
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}

.task-cal-day.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.task-cal-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.55);
}

.task-cal-day.is-selected {
  background: linear-gradient(145deg, #a855f7, #7c3aed);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.task-cal-day:hover:not(.is-empty):not(.is-selected) {
  background: rgba(255, 255, 255, 0.1);
}

.task-cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
  font-size: 0.72rem;
  color: var(--text-soft);
}

.task-cal-clear {
  border: none;
  background: transparent;
  color: #c4b5fd;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}

.task-cal-clear:hover {
  color: #fff;
  text-decoration: underline;
}

.task-item {
  grid-template-columns: 22px 1fr auto auto auto auto auto;
}

.task-confirm-panel {
  width: min(380px, 100%);
  text-align: center;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.task-confirm-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fecaca;
  margin-bottom: 4px;
}

.task-confirm-icon svg {
  width: 20px;
  height: 20px;
}

.task-confirm-panel h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.task-confirm-text {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.4;
}

.task-confirm-text strong {
  color: var(--text);
  font-weight: 600;
}

.task-confirm-actions {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  padding-top: 0;
  border-top: none;
}

.task-confirm-danger {
  background: linear-gradient(145deg, #ef4444, #b91c1c) !important;
  box-shadow: none;
}

.task-confirm-danger:hover {
  filter: brightness(1.05);
}

@media (max-width: 720px) {
  .task-modal-body {
    grid-template-columns: 1fr;
  }

  .task-modal-side {
    order: -1;
  }

  .task-cal-card {
    max-width: 280px;
  }
}

.tasks-list-panel {
  min-height: 0;
  overflow: auto;
}

.tasks-empty {
  margin: 0;
  padding: 18px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.task-item.is-done .task-main strong {
  text-decoration: line-through;
  opacity: 0.65;
}

.task-item.is-timing {
  border-color: rgba(168, 85, 247, 0.35);
}

.task-item .checkbox {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.task-item .checkbox:disabled {
  cursor: default;
  opacity: 0.5;
}

.task-timer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  min-width: 78px;
  justify-content: center;
}

.task-timer-btn svg {
  width: 14px;
  height: 14px;
}

.task-timer-btn.is-running {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(168, 85, 247, 0.15);
  color: #e9d5ff;
}

.task-timer-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.star-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: inherit;
  display: grid;
  place-items: center;
}

.star-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.task-delete-btn {
  cursor: pointer;
}

.projects-page .project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.projects-page .project-meta .panel-link {
  margin: 0;
  font-size: 0.8rem;
}

@media (max-width: 1100px) {
  .page-grid-2,
  .cards-grid,
  .page-stats,
  .mail-layout,
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .cal-days {
    grid-auto-rows: minmax(76px, auto);
  }

  .cal-day {
    min-height: 76px;
  }

  .org-perm-grid {
    grid-template-columns: 1fr;
  }

  .app-modal {
    padding: 16px;
  }

  .task-field-row {
    grid-template-columns: 1fr;
  }
}
