:root {
  color-scheme: light;
  --bg: #e8e0d5;
  --surface: #f4ece2;
  --ink: #1b2238;
  --accent: #7a0608;
  --accent-strong: #5f0104;
  --muted: #584e43;
  --border: #cfbfab;
  --outline: #8b6f52;
  --nav-ink: #f7ebde;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(180deg, #e6ded3 0%, var(--bg) 48%, #ede5da 100%);
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 18px;
  row-gap: 8px;
  padding: 12px 24px 14px;
  border-bottom: 1px solid #4c0a0c;
  background: var(--accent);
}

.topbar h1 {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--nav-ink);
  font-size: 1.75rem;
  line-height: 1;
}

.topbar h1::before {
  content: "";
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  background-image: url("/logo/icon.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.topbar nav {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 560px;
}

.topbar a {
  color: var(--nav-ink);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.topbar a:hover {
  background: rgba(255, 246, 236, 0.16);
  border-color: rgba(255, 246, 236, 0.38);
  color: #fff9f1;
}

.content {
  max-width: 1180px;
  margin: 58px auto 40px;
  padding: 6px 40px 28px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.content > h2 {
  max-width: 15ch;
  margin: 0 0 14px;
  font-size: clamp(2.3rem, 4.6vw, 4.1rem);
  line-height: 1.02;
}

.content > p {
  max-width: 72ch;
  margin: 0 0 22px;
  font-size: 1rem;
}

.auth-shell {
  max-width: 520px;
  margin: 72px auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 8px 30px rgba(31, 14, 8, 0.06);
}

.auth-shell--microsoft {
  position: relative;
  overflow: hidden;
  max-width: 640px;
  margin: 54px auto;
  padding: 34px 30px 30px;
  border-radius: 18px;
  border: 1px solid #d7c5b0;
  background: linear-gradient(148deg, #f9f3eb 0%, #f0e3d4 44%, #efe4d8 100%);
  box-shadow: 0 28px 64px rgba(36, 18, 10, 0.14);
}

.auth-shell--microsoft::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -70px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(122, 6, 8, 0.2) 0%, rgba(122, 6, 8, 0.02) 70%);
  pointer-events: none;
}

.auth-brand {
  margin-bottom: 14px;
}

.auth-brand-logo {
  display: block;
  width: min(320px, 78vw);
  height: auto;
  margin: 0 auto 10px;
  filter: drop-shadow(0 8px 18px rgba(55, 12, 10, 0.15));
}

.auth-eyebrow {
  margin: 0;
  text-align: center;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #6f5241;
}

.auth-shell--microsoft > h2 {
  max-width: 100%;
  text-align: center;
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
}

.auth-subtitle {
  margin: 0 auto 20px;
  max-width: 50ch;
  text-align: center;
}

.auth-options {
  display: grid;
  gap: 14px;
}

.auth-option {
  padding: 16px;
  border: 1px solid #decfbe;
  border-radius: 12px;
  background: rgba(255, 251, 246, 0.88);
}

.auth-option h3 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.auth-signin-note {
  margin-top: 0;
  margin-bottom: 12px;
}

.auth-option-muted {
  background: #f6ede3;
}

.auth-option-muted p {
  margin: 0;
}

.demo-credentials {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #efe3d4;
  border-radius: 2px;
}

.demo-credentials h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.demo-credentials p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.demo-credentials ul {
  margin: 0;
  padding-left: 18px;
}

.demo-credentials code {
  background: #f6ece0;
  border: 1px solid #d9c8b4;
  border-radius: 2px;
  padding: 1px 4px;
}

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

.auth-alt-actions {
  margin-top: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.auth-form input {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #faf6f1;
  color: var(--ink);
  padding: 9px 10px;
}

button {
  border: 1px solid var(--accent-strong);
  border-radius: 2px;
  background: var(--accent);
  color: #fff8ef;
  padding: 9px 12px;
  cursor: pointer;
  font-family: inherit;
}

button:hover {
  background: var(--accent-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  padding: 0.72rem 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  width: 100%;
  border-color: #085ea5;
  background: linear-gradient(180deg, #1382d4 0%, #0f6ab4 100%);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(11, 95, 163, 0.26);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #1175be 0%, #0c5b9a 100%);
}

.btn-secondary {
  border-color: #5a5a5a;
  background: #666666;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #4f4f4f;
}

.logout-form {
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
  margin: 0;
}

.user-chip {
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--nav-ink);
  font-size: 0.9rem;
}

.topbar .user-chip button {
  border-color: #f4ddd0;
  background: transparent;
  color: #fff4e8;
}

.topbar .user-chip button:hover {
  background: rgba(255, 246, 236, 0.16);
}

.header-timer {
  grid-column: 1;
  grid-row: 1 / span 2;
  justify-self: start;
  align-self: center;
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.header-timer-clock {
  color: #fff3e7;
  font-family: "Consolas", "Menlo", "Monaco", monospace;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
}

.header-timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topbar .header-timer-btn {
  border: 1px solid rgba(255, 234, 220, 0.6);
  background: rgba(255, 245, 234, 0.08);
  color: #fff4e9;
  border-radius: 2px;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.topbar .header-timer-btn:hover {
  background: rgba(255, 245, 234, 0.18);
}

.topbar .header-timer-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.timer-modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 9, 4, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 999;
}

.timer-modal.hidden {
  display: none;
}

.timer-modal-card {
  width: min(520px, 100%);
  background: #f8f1e8;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 16px;
}

.timer-modal-card h3 {
  margin: 0 0 8px;
}

.timer-modal-duration {
  margin: 0 0 10px;
}

.timer-modal-form {
  display: grid;
  gap: 10px;
}

.timer-modal-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.timer-modal-form select,
.timer-modal-form textarea {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #faf6f1;
  color: var(--ink);
  padding: 9px 10px;
}

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

.timer-modal-error {
  min-height: 1.2em;
  margin: 0;
  color: #8c1111;
  font-size: 0.88rem;
}

.error-banner {
  border: 1px solid #e5a3a3;
  background: #ffe7e7;
  color: #7a1010;
  padding: 10px;
  border-radius: 8px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-content {
  max-width: 1100px;
}

.admin-card {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px;
  margin-bottom: 14px;
  background: #f7f0e8;
}

.status-banner {
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 14px;
}

.status-success {
  border: 1px solid #ab9b84;
  background: #f2e7d7;
  color: #3b3127;
}

.status-error {
  border: 1px solid #e5a3a3;
  background: #ffe7e7;
  color: #7a1010;
}

.settings-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.settings-grid label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.settings-grid input,
.settings-grid select,
.settings-grid textarea {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #faf6f1;
  padding: 9px 10px;
}

.settings-grid small {
  color: var(--muted);
  font-weight: 400;
}

.settings-actions {
  grid-column: 1 / -1;
}

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

.test-actions form {
  margin: 0;
}

.inbox-content {
  max-width: 1100px;
}

.inbox-list {
  display: grid;
  gap: 10px;
}

.inbox-item {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 12px;
  background: #f7f0e8;
}

.inbox-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.inbox-item h4 {
  margin: 0;
  font-size: 1rem;
}

.inbox-item header span {
  color: var(--muted);
  font-size: 0.85rem;
}

.inbox-from {
  margin: 8px 0;
  color: #44362a;
  font-weight: 600;
}

.inbox-unread {
  border-left: 4px solid var(--accent);
  background: #f5ebdc;
}

.projects-content {
  max-width: 1180px;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.projects-search {
  display: flex;
  gap: 8px;
}

.projects-search input {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #faf6f1;
  padding: 9px 10px;
  min-width: 260px;
}

.project-board-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.project-column {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px;
  background: #f7f0e8;
}

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

.project-column h4 {
  margin: 0;
}

.project-column header span {
  background: #ecdfce;
  color: #4d3e2f;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.85rem;
}

.project-empty {
  margin: 0;
  color: var(--muted);
}

.project-cards {
  display: grid;
  gap: 8px;
}

.project-card-link {
  text-decoration: none;
  color: inherit;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px;
  background: #fbf6ef;
}

.project-card h5 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.project-card p {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.project-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-metrics span {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4px 8px;
  font-size: 0.85rem;
  background: #f4ece2;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
}

.project-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.project-tabs a,
.tab-subnav a {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--ink);
  background: #f5ede4;
  padding: 6px 10px;
}

.project-tabs a.active,
.tab-subnav a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tasks-content {
  max-width: 1100px;
}

.dashboard-content {
  max-width: 1180px;
}

.dashboard-hero {
  margin-bottom: 22px;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.dashboard-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-main-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dashboard-footer-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dashboard-stat-card h3 {
  margin-bottom: 8px;
}

.dashboard-stat {
  margin: 0 0 8px;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--accent);
}

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

.dashboard-card-head h3 {
  margin: 0;
}

.dashboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.dashboard-list li {
  border: 1px solid var(--border);
  background: #fbf6ef;
  border-radius: 2px;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.dashboard-list li p {
  margin: 4px 0 0;
  font-size: 0.86rem;
}

.dashboard-list-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
  white-space: nowrap;
  font-size: 0.85rem;
}

.dashboard-compact-list li {
  align-items: center;
}

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

.dashboard-notes {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.dashboard-notes li {
  color: var(--muted);
}

.task-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.task-filters label {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.task-filters select,
.task-filters input {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #faf6f1;
  padding: 8px 10px;
}

.task-list {
  display: grid;
  gap: 14px;
}

.task-item {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 12px;
  background: #f7f0e8;
}

.task-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.task-item-head h4 {
  margin: 0 0 4px;
}

.task-pill-row {
  display: flex;
  gap: 6px;
}

.task-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  background: #f4ece2;
}

.task-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-actions form {
  margin: 0;
}

.task-edit {
  margin-top: 10px;
}

.task-edit summary {
  cursor: pointer;
  color: #583628;
  font-weight: 600;
  margin-bottom: 8px;
}

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

.inline-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-form select {
  min-width: 150px;
}

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

.timesheets-content {
  max-width: 1180px;
}

.documents-content {
  max-width: 1180px;
}

.docs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.docs-stats span {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 10px;
  background: #f7f0e8;
}

.docs-folder-tree {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.docs-folder-tree a {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  padding: 4px 10px;
  background: #f4ece2;
}

.docs-folder-tree a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-nav a {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 10px;
  color: var(--ink);
  background: #f4ece2;
}

.week-nav strong {
  display: inline-block;
  min-width: 130px;
  text-align: center;
}

.invoices-content {
  max-width: 1180px;
}

.invoice-tabs {
  margin-top: 10px;
}

.btn-link {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--outline);
  border-radius: 2px;
  color: var(--ink);
  background: transparent;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.btn-link:hover {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #fff8ef;
}

.btn-link.small {
  padding: 4px 8px;
  font-size: 0.8rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: #51382b;
}

h1,
h2,
h3 {
  margin-top: 0;
}

p {
  color: var(--muted);
}

/* Calendar Events Grid */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 0;
}

.event-card h3 {
  color: var(--accent);
  font-size: 1.2rem;
  margin: 0 0 12px 0;
}

.event-details {
  font-size: 0.95rem;
}

.event-details p {
  margin: 8px 0;
  color: var(--muted);
}

.attendees-list {
  list-style: none;
  padding-left: 16px;
  margin: 4px 0;
}

.attendees-list li {
  margin: 4px 0;
  color: var(--muted);
}

.event-description {
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-top: 12px !important;
}

.error-message {
  background: #ffe6e6;
  border: 1px solid #ff6b6b;
  color: #b91c1c;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0;
}

.no-data {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 32px 16px;
}

@media (max-width: 700px) {
  .topbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
  }

  .topbar h1,
  .topbar nav,
  .logout-form,
  .user-chip,
  .header-timer {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
    align-self: auto;
  }

  .header-timer {
    width: 100%;
    min-width: 0;
  }

  .header-timer-actions {
    width: 100%;
  }

  .content {
    margin: 24px auto;
    padding: 0 16px 20px;
  }

  .content > h2 {
    font-size: clamp(1.9rem, 9vw, 2.8rem);
    max-width: 100%;
  }

  .content > p {
    max-width: 100%;
  }

  .dashboard-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-list-meta {
    justify-items: start;
  }

  .auth-shell {
    margin: 24px 14px;
  }

  .auth-shell--microsoft {
    margin: 24px 10px;
    padding: 24px 18px;
  }

  .auth-brand-logo {
    width: min(250px, 82vw);
  }
}
