/* Tasks application styles */

/* Brand fonts (see docs/design-guidelines.md). The licensed .woff2 files are
   not committed; drop them into /fonts/ (see fonts/README.md) and these
   @font-face rules pick them up. Until then the fallback stacks render. */
@font-face {
  font-family: 'BD Megalona';
  src: url('/fonts/BDMegalona-ExtraLight.woff2') format('woff2');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BD Megalona';
  src: url('/fonts/BDMegalona-ExtraLightItalic.woff2') format('woff2');
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'BB Noname Pro';
  src: url('/fonts/BBNonamePro-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Core palette (see docs/design-guidelines.md): light interface, white
   surfaces, #038BFF primary/next actions, vibrant coral + a purple-to-dark-blue
   gradient as brand accents. Everything references these variables so a future
   dark mode only needs an alternate :root[data-theme=dark] block. */
:root {
  --color-bg: #fafafc;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-muted: #5b5b6e;
  --color-border: #ececf4;
  --color-primary: #038bff;
  --color-accent: #ff6b4a;
  --color-accent-soft: #ffe9e3;
  --color-danger: #b91c1c;
  --color-sidebar-top: #4c1d95;
  --color-sidebar-bottom: #1e1b4b;
  --color-sidebar-text: #ece9fb;
  /* Board (monday.com-style) group + status colors */
  --board-blue: #579bfc;
  --board-green: #00c875;
  --board-purple: #a25ddc;
  --board-orange: #fdab3d;
  --board-red: #e2445c;
  --board-gray: #797e93;
  --font-display: 'BD Megalona', 'Didot', 'Playfair Display', Georgia, serif;
  --font-body: 'BB Noname Pro', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --sidebar-width: 172px;
  --admin-submenu-width: 184px;
  --mobile-topbar-height: 52px;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Titles and anything asking the user to do something use the display font */
h1, h2, h3, .page-title {
  font-family: var(--font-display);
  font-weight: 200;
}

/* The most important words of instruction text ("Enter your code.") are bold
   italic in the display font so they are easy to pick out. */
.prompt-em {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
}

/* ===== Left sidebar layout ===== */

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-sidebar-top), var(--color-sidebar-bottom));
  color: var(--color-sidebar-text);
  z-index: 1200;
}

.sidebar-title {
  padding: 16px 12px 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-title a {
  color: #fff;
  text-decoration: none;
}

/* Main menu: middle section, scrolls if too long */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: 14px;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.sidebar-item:hover,
.sidebar-item:focus {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--color-accent);
  font-weight: 600;
}

/* Group navigation: indented sub-links under groups the user admins */
.sidebar-group {
  font-weight: 600;
}

.sidebar-subitem {
  padding-left: 26px;
  font-size: 13px;
}

.sidebar-more,
.sidebar-new-group {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

/* ===== Task list page chrome ===== */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.view-toggle {
  display: inline-flex;
  gap: 6px;
}

/* ===== Board (monday.com-style spreadsheet) — tasks/index.php ===== */

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}

/* Segmented view switcher (By Week / By Category) */
.seg {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-surface);
}

.seg a {
  padding: 7px 14px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  border-right: 1px solid var(--color-border);
}

.seg a:last-child {
  border-right: 0;
}

.seg a:hover {
  background: #f5f8ff;
  color: var(--color-text);
}

.seg a.active {
  background: var(--color-primary);
  color: #fff;
}

/* Filter chips (Only my tasks / Show completed) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.chip:hover {
  background: #f5f8ff;
  color: var(--color-text);
}

.chip.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #eef6ff;
  font-weight: 600;
}

.board-search {
  width: 220px;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.board-toolbar form {
  margin-left: auto;
}

/* One group section: colored title + white table card with a color rail */
.board-group {
  margin-bottom: 26px;
}

.board-group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px 2px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--group-color, var(--board-blue));
}

.board-group-title .count {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.board-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 6px solid var(--group-color, var(--board-blue));
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(26, 26, 46, 0.05);
  overflow-x: auto;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.board-table th {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.board-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.board-table th + th,
.board-table td + td {
  border-left: 1px solid #f4f4f9;
}

.board-table tbody tr:last-child td {
  border-bottom: 0;
}

.board-table tbody tr:hover td {
  background: #f7f9fd;
}

.board-table .col-assignee { width: 170px; }
.board-table .col-due      { width: 150px; }
.board-table .col-sched    { width: 185px; }
.board-table .col-sent     { width: 105px; }
.board-table .col-actions  { width: 150px; }

.board-task-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}

.board-task-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Assignee: colored initials circle + name */
.assignee {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.assignee-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none;
}

.assignee-name {
  font-size: 13px;
}

.unassigned {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Status pills for due dates / completion */
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.pill-overdue { background: var(--board-red); }
.pill-today   { background: var(--board-orange); }
.pill-soon    { background: var(--board-blue); }
.pill-done    { background: var(--board-green); }

.pill-later,
.pill-none {
  background: #eceef5;
  color: var(--color-text-muted);
}

/* Completed pill doubles as a button: click to mark incomplete again */
button.pill-btn {
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
}

button.pill-btn:hover {
  background: #00a25e;
  box-shadow: 0 1px 4px rgba(0, 200, 117, 0.4);
}

.board-table .col-email { width: 130px; }

/* Footnote under the toolbar: when scheduled emails actually go out */
.sched-note {
  margin: -8px 0 14px;
  color: var(--color-text-muted);
}

/* "Email sends" column: next scheduled send; admins expand to edit */
.sched-when {
  font-size: 12.5px;
  color: var(--color-text);
  white-space: nowrap;
}

.sched-custom-badge {
  display: inline-block;
  background: #dcecfd;
  color: #1567c4;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}

.sched-edit summary {
  list-style: none;
  cursor: pointer;
  color: inherit;
}

.sched-edit summary::-webkit-details-marker {
  display: none;
}

.sched-edit summary:hover .sched-when {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-style: dotted;
}

.sched-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.sched-form input[type="datetime-local"] {
  width: auto;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 6px;
}

.sched-form .button,
.sched-form button {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ===== Task detail page (tasks/view.php) ===== */

.back-link {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 13px;
}

.back-link:hover {
  color: var(--color-primary);
}

.task-head h1 {
  margin: 6px 0 10px;
}

/* Property card: white surface with a status-colored rail, monday-style */
.task-props {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 6px solid var(--group-color, var(--board-blue));
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(26, 26, 46, 0.05);
  margin-bottom: 16px;
}

.task-prop {
  padding: 12px 16px;
}

.task-prop + .task-prop {
  border-left: 1px solid #f4f4f9;
}

.task-prop-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.task-prop-value {
  font-size: 14px;
}

/* Tiny Edit/Cancel toggle inside a property label */
.prop-edit-link {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 6px;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.prop-edit-link:hover {
  text-decoration: underline;
}

.reminders-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.reminders-form {
  flex-direction: column;
  align-items: stretch;
}

.reminders-form input[type="number"] {
  width: 70px;
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 6px;
}

.reminders-form .button {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.reminders-form .reminder-row {
  font-size: 13px;
  margin-bottom: 4px;
}

.reminder-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.task-instructions p {
  margin: 4px 0 2px;
  line-height: 1.6;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-head-row h3 {
  margin: 6px 0;
}

/* Subtle inline-edit affordance (admin-only controls) */
.edit-btn {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

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

.update-attach {
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
}

.update-attach input[type="file"] {
  width: auto;
  border: 0;
  padding: 0;
  font-size: 13px;
}

/* Update feed */
.update {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}

.update:first-of-type {
  border-top: 0;
  padding-top: 4px;
}

.update-body {
  flex: 1;
  min-width: 0;
}

.update-body p {
  margin: 4px 0 2px;
  line-height: 1.55;
}

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

.update-delete {
  margin-left: auto;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.link-button:hover {
  color: var(--color-danger);
}

.attachment-chip {
  display: inline-block;
  background: #f4f6fb;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
}

.attachment-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* "Sent" column */
.sent-yes {
  color: var(--board-green);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}

.email-preview-btn {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.email-preview-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #eef6ff;
}

/* ===== Gmail-style email preview modal ===== */

.email-compose {
  background: #fff;
  width: 100%;
  max-width: 620px;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 14px;
}

.email-compose-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f2f6fc;
  color: #041e49;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
}

.email-compose-close {
  background: none;
  border: 0;
  color: #444746;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  border-radius: 4px;
}

.email-compose-close:hover {
  background: #e1e5ea;
  color: #041e49;
}

.email-compose-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #eceef5;
  color: #1f1f1f;
}

.email-compose-label {
  color: #5e5e5e;
  font-size: 13px;
  min-width: 38px;
}

.email-compose-subject {
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  white-space: nowrap;
  overflow-x: auto;
}

.email-compose-body {
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 220px;
  max-height: 45vh;
  overflow-y: auto;
}

.email-compose-subject:focus,
.email-compose-body:focus {
  outline: none;
}

/* Variables stay [tokens] until send time; shown as plain blue text so it is
   clear the site fills them in (no tag box) */
.token-pill {
  color: #1567c4;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

.email-compose-hint .hint-blue {
  color: #1567c4;
}

.email-compose-hint {
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid #eceef5;
  background: #fafbfe;
}

.email-compose-hint code {
  background: #dcecfd;
  color: #1567c4;
  border-radius: 3px;
  padding: 0 3px;
}

.email-compose-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 14px;
  border-top: 1px solid #eceef5;
}

/* Gmail's blue pill send button, relabeled */
.email-send-btn {
  background: #0b57d0;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.email-send-btn:hover {
  background: #0842a0;
}

.email-reset-btn {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
}

/* Subtle per-row Done button: turns green on hover */
.done-btn {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.done-btn:hover {
  background: var(--board-green);
  border-color: var(--board-green);
  color: #fff;
}

.comment p {
  margin: 6px 0;
}

fieldset.reminders,
fieldset.assignees {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
}

fieldset.reminders legend,
fieldset.assignees legend {
  font-size: 13px;
  color: var(--color-text-muted);
  padding: 0 4px;
}

/* Assignee checkboxes: compact multi-column list of group members */
.assignee-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2px 14px;
  margin: 6px 0;
}

.assignee-checklist label.inline,
fieldset.assignees > label.inline {
  font-weight: 400;
  margin: 2px 0;
}

.assignee-select-all {
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--color-border);
  margin-bottom: 4px;
}

/* Multiple assignee chips wrap within a table cell */
.assignee-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.reminder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

/* ===== Minimal layout (token-authenticated email flow, /t/) ===== */

body.minimal {
  background: var(--color-bg);
}

.minimal-header {
  background: linear-gradient(180deg, var(--color-sidebar-top), var(--color-sidebar-bottom));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 200;
  font-size: 20px;
  padding: 14px 20px;
}

.minimal-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Bottom-anchored: Admin menu + profile photo */
.sidebar-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-menu-wrap {
  position: relative;
}

.sidebar-item-icon {
  font-size: 16px;
  line-height: 1;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex: none;
}

.sidebar-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}


/* Pop-up menus opening upward from the bottom anchors */
.popup-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 180px;
  padding: 6px;
  z-index: 1300;
}

.popup-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--color-text);
  text-decoration: none;
}

.popup-menu a:hover,
.popup-menu a:focus {
  background: #f5f5f7;
}

/* Admin submenu: on desktop it is a persistent full-height rail to the RIGHT
   of the sidebar so users can navigate between admin sections (overridden to
   an inline accordion on mobile in the media query below). */
.popup-menu.admin-submenu {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--sidebar-width);
  width: var(--admin-submenu-width);
  border: 0;
  border-right: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.06);
  padding: 10px 8px;
  min-width: 0;
  z-index: 1190;
}

.admin-submenu-title {
  padding: 8px 10px 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.popup-menu.admin-submenu a.active {
  background: #eef2ff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

/* Shift the page content over while the admin rail is open (desktop only) */
@media (min-width: 769px) {
  body.admin-submenu-open .content {
    margin-left: calc(var(--sidebar-width) + var(--admin-submenu-width));
  }
}

/* Content area to the right of the sidebar */
.content {
  margin-left: var(--sidebar-width);
}

.content.no-sidebar {
  margin-left: 0;
}

main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Mobile top bar (hidden on desktop) */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-topbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--color-sidebar-bottom);
  color: #fff;
  z-index: 1100;
}

.mobile-topbar-title {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

.sidebar-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 8px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1150;
}

/* Legacy in-page dropdown (e.g. Admin Actions on admin/user_edit.php) */
.nav-admin-wrap {
  position: relative;
}

.nav-admin-link {
  cursor: pointer;
}

.admin-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 160px;
  padding: 6px;
  z-index: 1000;
}

.admin-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--color-text);
  text-decoration: none;
}

.admin-menu a:hover,
.admin-menu a:focus {
  background: #f5f5f7;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  padding: 16px;
  margin-bottom: 6px;
}

/* Typography */
h2 {
  margin: 8px 0 16px;
}

h3 {
  margin: 6px 0 10px;
}

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

/* Forms */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack label {
  display: block;
  margin: 8px 0;
}

.stack .actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 500;
}

label.inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 8px;
  border: 1px solid #d9d9e3;
  border-radius: 8px;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(3, 139, 255, 0.25);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  vertical-align: middle;
}

/* Buttons */
button,
.button {
  display: inline-block;
  background: #111;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
}

button.primary,
.button.primary {
  background: var(--color-primary);
}

button.danger {
  background: var(--color-danger);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.inline {
  display: inline;
}

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

/* Circular "+" button (e.g. Add a person, top-right of a page head) */
.plus-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 2px;
  box-shadow: 0 2px 6px rgba(3, 139, 255, 0.35);
}

.plus-btn:hover {
  background: #0074d4;
}

/* Messages */
.flash {
  background: #e8f6ee;
  color: #0f5d2f;
  padding: 10px;
  border-radius: 8px;
}

.error {
  background: #ffe8e8;
  color: #7a0000;
  padding: 10px;
  border-radius: 8px;
}

.announcement {
  background: #fff7e6;
  border: 1px solid #ffd699;
  color: #7a4a00;
  padding: 10px;
  border-radius: 8px;
}

/* Tables */
.list {
  width: 100%;
  border-collapse: collapse;
}

.list th,
.list td {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.list th {
  background: #f8f9fa;
  font-weight: 600;
}

.list tr:hover {
  background: #f8f9fa;
}

/* Status indicators */
.due-overdue {
  color: #b91c1c;
  font-weight: 600;
}

.due-today {
  color: #b45309;
  font-weight: 600;
}

.due-soon {
  color: #1d4ed8;
  font-weight: 500;
}

.status-verified {
  color: #28a745;
  font-weight: 500;
}

.status-pending {
  color: #ffc107;
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.badge.success {
  background: #e6fbf0;
  color: #0b7042;
}

/* Group settings sub-navigation (General / Email Templates / Email Sending) */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--color-border);
}

.settings-tabs a {
  padding: 8px 14px;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.settings-tabs a:hover {
  color: var(--color-text);
}

.settings-tabs a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* Auth pages */
.auth {
  display: grid;
  place-items: center;
  height: 100vh;
  background: var(--color-sidebar-bottom);
  color: #000;
}

.auth .card {
  width: 360px;
}

.auth .card .logo {
  display: block;
  max-width: 120px;
  height: auto;
  margin: 0 auto 16px auto;
}

.auth .card .subtitle {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin: 8px 0 24px 0;
  font-weight: 500;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  max-width: 520px;
  width: 100%;
  border-radius: 16px;
  padding: 16px;
  position: relative;
}

.modal .close {
  position: absolute;
  right: 8px;
  top: 8px;
  background: #eee;
  color: #333;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  line-height: 28px;
  font-size: 20px;
  border: 0;
  padding-top: 3px;
  padding-left: 10px;
}

/* Utility */
.hidden {
  display: none !important;
}

details summary {
  cursor: pointer;
  color: var(--color-primary);
}

.description {
  padding-bottom: 10px;
}

/* Responsive: sidebar collapses behind the top-left menu icon */
@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .content {
    margin-left: 0;
    padding-top: var(--mobile-topbar-height);
  }

  /* Admin submenu: inline accordion beneath the Admin item. The bottom block
     is anchored, so expanding the menu pushes the Admin item up. */
  .popup-menu.admin-submenu {
    position: static;
    width: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    min-width: 0;
    padding: 2px 0 4px 26px;
  }

  .admin-submenu-title {
    display: none;
  }

  .popup-menu.admin-submenu a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .popup-menu.admin-submenu a {
    color: var(--color-sidebar-text);
    padding: 9px 12px;
  }

  .popup-menu.admin-submenu a:hover,
  .popup-menu.admin-submenu a:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  main {
    padding: 16px;
    margin: 0 auto;
  }

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

  .grid {
    grid-template-columns: 1fr !important;
  }
}
