:root {
  --bg-main: #f7f8fa;
  --panel-bg: #ffffff;
  --brand: #2f648f;
  --accent: #c8aa82;
  --text-main: #223447;
  --line-soft: #d8e3ee;

  --bs-primary: var(--brand);
  --bs-link-color: #376f9d;
  --bs-link-hover-color: #274f72;

  --font-ui: "Manrope", "Segoe UI", sans-serif;
  --font-display: "DM Serif Display", Georgia, serif;
}

body {
  background: radial-gradient(circle at 20% 10%, #ffffff, #f5f8fc 42%, #f4eee4 100%);
  color: var(--text-main);
  font-family: var(--font-ui);
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hero {
  background: linear-gradient(120deg, #f7fbff, #f3ece2);
  border-bottom: 1px solid var(--line-soft);
}

.app-title {
  font-family: var(--font-display);
  color: var(--brand);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  letter-spacing: 0.01em;
}

.header-search {
  max-width: 210px;
}

.workspace-badge {
  color: var(--bs-primary, #0d6efd);
  font-weight: 700;
  letter-spacing: 0.04em;
}

#workspaceTitleWrap {
  white-space: nowrap;
}

.action-short-wide {
  min-width: 110px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.panel {
  border: 0;
  box-shadow: 0 10px 26px rgba(27, 49, 77, 0.08);
  background: var(--panel-bg);
  border-radius: 14px;
}

.card-title,
.panel h5 {
  font-weight: 700;
}

.form-control,
.form-select,
.btn {
  border-radius: 10px;
}

.form-control,
.form-select {
  border-color: #cfd9e4;
}

.form-control:focus,
.form-select:focus {
  border-color: #8aa9c5;
  box-shadow: 0 0 0 0.2rem rgba(47, 100, 143, 0.16);
}

.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #275274;
  border-color: #275274;
}

.btn-outline-secondary {
  border-color: #c7d2de;
  color: #2c475f;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #edf3f8;
  color: #21384d;
  border-color: #b4c2d1;
}

.admin-shell {
  border-radius: 14px;
  width: 100%;
}

.admin-side-nav {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: calc(100vh - 150px);
  padding: 10px;
  border-right: 1px solid #e3e7e6;
}

.admin-page-wide {
  max-width: 100%;
}

.admin-layout-row {
  align-items: stretch;
}

.admin-content-col .card.panel {
  border-radius: 12px;
}

@media (max-width: 1199.98px) {
  .admin-side-nav {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #e3e7e6;
    padding-bottom: 12px;
  }
}

.admin-nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  cursor: pointer;
  color: #30444a;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-nav-link:hover,
.admin-nav-link:focus,
.admin-nav-link.active {
  background: #ecf3f9;
  color: var(--brand);
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.pa-nav {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #30444a;
  font-weight: 600;
}

.pa-nav:hover,
.pa-nav.active {
  background: #ecf3f9;
  color: var(--brand);
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.note-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.note-card {
  border: 1px solid #d8e2ec;
  border-radius: 12px;
  padding: 5px 7px;
  background: #fff;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.note-card .note-actions {
  display: flex;
  gap: 10px;
  border-top: 1px solid #edf2f7;
  padding-top: 3px;
}

.note-card .note-main {
  cursor: pointer;
  width: 100%;
}

.note-card-title {
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.2;
}

.note-card-meta {
  color: #6b777a;
  font-size: 0.74rem;
  line-height: 1.2;
}

.note-action-link {
  color: var(--bs-primary, #0d6efd);
  text-decoration: none;
  font-size: 0.73rem;
  font-weight: 700;
}

.note-action-link:hover {
  text-decoration: underline;
}

.note-action-danger {
  color: #b02a37;
}

#noteEditor.ql-container {
  height: 360px;
  min-height: 260px;
  max-height: 70vh;
  overflow: hidden;
  resize: vertical;
}

#noteEditor .ql-editor {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

#noteSourceArea {
  min-height: 240px;
  max-height: 70vh;
  overflow-y: auto;
  resize: vertical;
}

.task-modal-editor .ql-editor {
  min-height: 140px;
  max-height: 28vh;
  overflow-y: auto;
}

.note-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #efefef;
  padding: 8px 0;
}

.note-mini-card {
  border: 1px solid #d8e2ec;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
}

.note-mini-card:hover {
  border-color: #b9cadc;
}

.note-list-row {
  border: 1px solid #d8e2ec;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-list-row:hover {
  border-color: #b9cadc;
}

.note-list-title {
  font-weight: 700;
}

.clickable {
  cursor: pointer;
}

.pill {
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 2px 8px;
  background: #edf3f9;
}

mark {
  background: #f4e2c7;
  padding: 0 2px;
}

.completed-row td {
  color: #7f8c8f;
  text-decoration: line-through;
}

.task-status-overdue {
  color: #b91c1c;
  font-weight: 700;
}

.task-priority-pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
}

.task-priority-pill.priority-low {
  background: #e6f4ea;
  color: #1e6a3b;
}

.task-priority-pill.priority-med {
  background: #eef2ff;
  color: #334155;
}

.task-priority-pill.priority-high {
  background: #fff4cc;
  color: #8a5a00;
}

.task-priority-pill.priority-critical {
  background: #fee2e2;
  color: #991b1b;
}

#tasksCard table,
#followUpsCard table {
  font-size: 0.89rem;
}

#tasksCard table th,
#tasksCard table td,
#followUpsCard table th,
#followUpsCard table td {
  padding: 0.35rem 0.45rem;
}

body:not(.focus-tasks) #tasksCard .task-extra-col {
  display: none;
}

#tasksCard .note-link-btn,
#followUpsCard .note-link-btn {
  font-size: 0.72rem;
  white-space: nowrap;
  line-height: 1.1;
  padding: 0.12rem 0.35rem;
}

.meeting-row-card {
  border-color: #d8e2ec !important;
  background: #fff;
}

.meeting-row-title {
  font-weight: 600;
  line-height: 1.3;
}

.meeting-row-meta {
  margin-top: 0.2rem;
}

body.focus-tasks #notesColumn,
body.focus-followups #notesColumn {
  order: 2;
}

body.focus-tasks #workColumn,
body.focus-followups #workColumn {
  order: 1;
}

body.focus-tasks #workColumn,
body.focus-followups #workColumn {
  flex: 0 0 auto;
  width: 66.66666667%;
}

body.focus-tasks #notesColumn,
body.focus-followups #notesColumn {
  flex: 0 0 auto;
  width: 33.33333333%;
}

body.focus-tasks #followUpsCard,
body.focus-followups #tasksCard {
  opacity: 0.92;
}

@media (max-width: 991.98px) {
  body.focus-tasks #workColumn,
  body.focus-followups #workColumn,
  body.focus-tasks #notesColumn,
  body.focus-followups #notesColumn {
    width: 100%;
  }

  .notes-toolbar-controls {
    width: 100%;
  }

  .notes-toolbar-controls #noteCategoryFilter,
  .notes-toolbar-controls #noteDateScope {
    min-width: 150px;
    flex: 1 1 150px;
  }

  .notes-toolbar-controls #noteDateFilter {
    flex: 1 1 180px;
    max-width: none !important;
  }
}

@media (max-width: 767.98px) {
  .hero {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
  }

  .header-search {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  #workspaceTitleWrap {
    white-space: normal;
  }

  .action-short-wide {
    min-width: 0;
  }

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

  .notes-toolbar {
    align-items: stretch !important;
  }

  .notes-toolbar-controls {
    width: 100%;
  }

  .notes-toolbar-controls .form-select,
  .notes-toolbar-controls .form-control {
    width: 100%;
    max-width: none !important;
  }

  .notes-toolbar-controls .btn {
    flex: 1 1 calc(50% - 0.4rem);
  }

  #notesMeta,
  #autosaveStatus {
    width: 100%;
  }

  .note-editor-actions .btn {
    flex: 1 1 calc(50% - 0.4rem);
  }

  .note-attachment-row .form-control,
  .note-attachment-row .btn {
    width: 100%;
  }

  .meeting-toolbar-controls {
    width: 100%;
  }

  .meeting-toolbar-controls #meetingDateScope,
  .meeting-toolbar-controls #meetingSearch {
    width: 100%;
    max-width: none !important;
  }

  .meeting-row-top {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.45rem;
  }

  .meeting-row-actions {
    width: 100%;
  }

  .meeting-row-actions .btn {
    flex: 1 1 calc(50% - 0.3rem);
  }

  #noteEditor.ql-container {
    height: 300px;
    min-height: 210px;
    max-height: 60vh;
  }

  #noteSourceArea {
    min-height: 210px;
    max-height: 60vh;
  }

  .note-card .note-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  #tasksCard table,
  #followUpsCard table,
  .task-widget-card table {
    font-size: 0.81rem;
  }

  #tasksCard .note-link-btn,
  #followUpsCard .note-link-btn {
    font-size: 0.68rem;
  }
}

@media (max-width: 575.98px) {
  .task-mobile-table thead,
  .follow-mobile-table thead {
    display: none;
  }

  .task-mobile-table,
  .follow-mobile-table,
  .task-mobile-table tbody,
  .follow-mobile-table tbody,
  .task-mobile-table tr,
  .follow-mobile-table tr,
  .task-mobile-table td,
  .follow-mobile-table td {
    display: block;
    width: 100%;
  }

  .task-mobile-table tr,
  .follow-mobile-table tr {
    border: 1px solid #d8e2ec;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 0.6rem;
    padding: 0.35rem 0.55rem;
  }

  .task-mobile-table td,
  .follow-mobile-table td {
    border: 0 !important;
    position: relative;
    padding: 0.26rem 0.25rem 0.26rem 6.2rem !important;
    min-height: 1.8rem;
    white-space: normal;
  }

  .task-mobile-table td::before,
  .follow-mobile-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.25rem;
    top: 0.3rem;
    width: 5.6rem;
    font-size: 0.72rem;
    color: #60788e;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .task-mobile-table td[data-label="Done"],
  .follow-mobile-table td[data-label="Done"] {
    padding-left: 0.25rem !important;
    min-height: 1.5rem;
  }

  .task-mobile-table td[data-label="Done"]::before,
  .follow-mobile-table td[data-label="Done"]::before {
    display: none;
  }

  body:not(.focus-tasks) #tasksCard .task-extra-col {
    display: block !important;
  }

  .meeting-row-actions .btn {
    flex: 1 1 100%;
  }
}

.task-widget-card table {
  font-size: 0.84rem;
}

.task-widget-card th,
.task-widget-card td {
  padding: 0.32rem 0.4rem;
}

.widget-drag-handle {
  cursor: grab;
  color: #5f7a80;
}

.command-suggest {
  position: relative;
  margin-top: 6px;
  border: 1px solid #d5dfdf;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
}

.command-suggest-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eef2f2;
  background: #fff;
  text-align: left;
  padding: 8px 10px;
}

.command-suggest-item:last-child {
  border-bottom: 0;
}

.command-suggest-item:hover {
  background: #f3f7f7;
}
