:root {
  --ink: #181713;
  --muted: #69615b;
  --line: #d5cebb;
  --surface: #fffdf7;
  --surface-soft: #f4f1e8;
  --shell: #f7f8f4;
  --nav: #252520;
  --nav-soft: #3b3832;
  --nav-active: #82716e;
  --blue: #596f61;
  --green: #526f5b;
  --green-soft: #edf0e7;
  --amber: #82716e;
  --red: #b42318;
  --teal: #62786d;
  --shadow: 0 14px 34px rgba(40, 36, 28, 0.12);
  --shadow-soft: 0 1px 2px rgba(40, 36, 28, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--shell);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(130, 113, 110, 0.22);
  outline-offset: 2px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--nav);
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid rgba(228, 222, 205, 0.34);
  border-radius: 8px;
  background: var(--surface);
  padding: 26px;
  box-shadow: 0 26px 70px rgba(18, 16, 12, 0.34);
}

.auth-card .brand-mark {
  width: 48px;
  height: 48px;
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.auth-card h1 {
  font-size: 1.7rem;
}

.auth-card p {
  color: var(--muted);
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.auth-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
}

.auth-message {
  min-height: 20px;
  color: #b91c1c !important;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.admin-portal .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.admin-portal .sidebar,
.admin-portal .topbar {
  display: none;
}

.admin-portal .main-content {
  min-height: 100vh;
  padding: 24px;
}

.admin-portal #adminView.active-view {
  display: block;
}

.sidebar {
  background: var(--nav);
  color: #f7f5ee;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.brand-block,
.team-row,
.topbar,
.section-header,
.deal-meta,
.dialog-header,
.pipeline-toolbar,
.pipeline-toolbar-actions,
.deal-chip-row,
.activity-line,
.drawer-stat-grid {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #acb7ae;
  color: #181713;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.brand-block h1,
.topbar h2,
.section-header h3,
.dialog-header h3,
.stage-heading h3 {
  margin: 0;
}

.eyebrow,
.panel-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow,
.sidebar .panel-label {
  color: #d9d3c2;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.bottom-nav {
  margin-top: auto;
}

.nav-item {
  border: 0;
  color: #eee9dc;
  background: transparent;
  padding: 11px 12px;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--nav-active);
  color: #fffdf7;
}

.nav-item:hover {
  transform: translateX(1px);
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.placeholder-panel {
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
  box-shadow: 0 1px 0 rgba(40, 36, 28, 0.06);
}

.placeholder-panel h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.placeholder-panel p:not(.panel-label) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.main-content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

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

.current-user-badge {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.88);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.workspace-select {
  max-width: 250px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 400;
  box-shadow: var(--shadow-soft);
}

.search-box {
  min-width: min(430px, 44vw);
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  box-shadow: var(--shadow-soft);
}

.search-box input,
.form-stack input,
.form-stack select,
.dialog-form input,
.dialog-form select,
.section-header select,
.pipeline-toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}

.search-box input {
  border: 0;
  outline: 0;
}

.topbar-actions .secondary-action,
.pipeline-toolbar-actions .secondary-action,
.section-header select,
.pipeline-toolbar select {
  font-weight: 400;
}

.primary-action,
.secondary-action,
.icon-button,
.segment,
.mini-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.primary-action {
  background: var(--green);
  color: #fffdf7;
  padding: 0 14px;
  box-shadow: 0 8px 18px rgba(82, 111, 91, 0.2);
}

.secondary-action,
.mini-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  padding: 0 14px;
  box-shadow: var(--shadow-soft);
}

.primary-action:hover,
.secondary-action:hover,
.mini-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  background: #435f4d;
}

.secondary-action:hover,
.mini-button:hover,
.icon-button:hover {
  border-color: #c2b490;
  background: var(--surface-soft);
}

.icon-button {
  width: 38px;
  background: var(--surface-soft);
  color: var(--ink);
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.contact-card,
.deal-card,
.task-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.metric-card {
  padding: 16px 17px;
}

.metric-value {
  margin: 8px 0 0;
  font-size: 1.62rem;
  font-weight: 900;
  letter-spacing: 0;
}

.metric-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.content-grid,
.task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.panel {
  padding: 18px;
  box-shadow: var(--shadow);
}

.section-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header.compact {
  margin-bottom: 12px;
}

.section-header select,
.pipeline-toolbar select {
  max-width: 190px;
  height: 38px;
  padding: 0 10px;
}

.pipeline-toolbar {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.pipeline-toolbar-actions {
  gap: 10px;
}

.segmented-control {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-soft);
}

.segment {
  background: transparent;
  color: var(--muted);
  min-height: 32px;
  padding: 0 12px;
}

.segment.active {
  background: var(--green-soft);
  color: var(--green);
  box-shadow: var(--shadow-soft);
}

.pipeline-summary {
  display: grid;
  gap: 10px;
}

.stage-summary {
  display: grid;
  grid-template-columns: 120px 1fr 92px;
  align-items: center;
  gap: 12px;
}

.stage-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcd6c7;
}

.stage-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.stack-list,
.task-list {
  display: grid;
  gap: 10px;
}

.follow-up,
.task-row {
  padding: 12px;
}

.follow-up-button {
  width: 100%;
  border: 0;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.follow-up-button:hover,
.follow-up-button:focus-visible {
  border-color: #c2b490;
  box-shadow: 0 6px 16px rgba(40, 36, 28, 0.1);
}

.follow-up strong,
.contact-card strong,
.deal-card strong {
  display: block;
}

.follow-up p,
.contact-card p,
.deal-card p,
.task-row p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(250px, 1fr));
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
}

.stage-column {
  min-width: 250px;
  min-height: 610px;
  background: var(--surface);
  border: 1px solid #181713;
  border-radius: 8px;
  padding: 10px;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
  scroll-snap-align: start;
}

.stage-column.drop-target {
  background: var(--green-soft);
  border-color: #acb7ae;
  box-shadow: inset 0 0 0 2px rgba(172, 183, 174, 0.28);
}

.stage-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.stage-heading h3,
.deal-card strong {
  font-weight: 800;
}

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

.stage-total {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 400;
}

.stage-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.deal-list {
  display: grid;
  gap: 9px;
}

.deal-card {
  background: #cbce65;
  border-color: #aeb052;
  color: var(--ink);
  padding: 12px 18px;
  text-align: left;
  box-shadow: 0 10px 22px rgba(40, 36, 28, 0.14);
  cursor: grab;
}

.deal-card:hover {
  border-color: #82716e;
  box-shadow: 0 10px 22px rgba(40, 36, 28, 0.14);
}

.deal-card.dragging {
  cursor: grabbing;
  opacity: 0.55;
  transform: rotate(1deg);
}

.deal-card button {
  text-align: left;
}

.deal-open-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.deal-value {
  color: inherit;
  font-weight: 400;
}

.deal-card p,
.deal-card .deal-meta {
  color: #000000;
  font-weight: 400;
}

.deal-card,
.deal-card *,
.deal-card button {
  color: #000000;
  font-weight: 400;
}

.deal-card strong {
  font-weight: 800;
}

.deal-chip-row {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.deal-meta {
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.contact-tabs {
  width: fit-content;
  margin-bottom: 14px;
}

.contact-list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.compact-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.compact-select select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.sync-status {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.contact-card {
  padding: 16px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.contact-card:hover {
  border-color: #c2b490;
  box-shadow: 0 10px 22px rgba(40, 36, 28, 0.1);
  transform: translateY(-1px);
}

.contact-card > .link-button {
  display: block;
  font-size: 1rem;
  font-weight: 900;
}

.contact-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.contact-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.contact-table th,
.contact-table td {
  height: 38px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.contact-table th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 900;
}

.contact-table td:last-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.email-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: calc(100vh - 130px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.email-sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 12px;
}

.email-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 8px;
  padding: 11px 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.email-folder.active,
.email-folder:hover {
  background: var(--green-soft);
  color: var(--blue);
}

.email-folder span {
  color: var(--blue);
  font-size: 0.78rem;
}

.email-content {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
}

.email-banner,
.email-toolbar,
.email-detail-header,
.email-compose-toolbar,
.email-template-picker,
.email-template-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.email-banner,
.email-compose-main,
.email-link-panel,
.email-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.email-banner h3,
.email-detail-header h3 {
  margin: 0;
}

.email-banner p:not(.panel-label),
.email-detail-header p,
.email-link-panel p:not(.panel-label) {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.email-toolbar {
  color: var(--muted);
  font-weight: 800;
}

.email-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.email-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.email-table td {
  height: 42px;
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  white-space: nowrap;
  vertical-align: middle;
}

.email-table tr.unread td {
  font-weight: 900;
}

.email-open,
.email-subject {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.email-subject {
  display: inline-flex;
  gap: 8px;
  max-width: 640px;
}

.email-subject span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.email-link-suggestion,
.email-linked-box {
  margin-top: 6px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
}

.email-status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--blue);
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.email-compose-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.email-compose-main,
.email-link-panel,
.email-detail,
.email-side-stack {
  display: grid;
  gap: 12px;
}

.email-side-stack {
  align-content: start;
}

.email-compose-form {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.email-template-picker {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  justify-content: flex-start;
}

.email-template-picker select {
  min-width: 220px;
}

.email-compose-form label {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  color: var(--muted);
  font-weight: 800;
}

.email-compose-form input,
.email-compose-form select,
.email-compose-form textarea,
.email-link-panel select,
.email-link-panel input,
.email-link-panel textarea,
.email-template-picker select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: var(--surface);
}

.email-compose-form textarea,
.email-link-panel textarea {
  min-height: 220px;
  resize: vertical;
}

.email-link-panel textarea {
  min-height: 150px;
}

.email-link-panel h3 {
  margin: 0;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.email-template-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.email-compose-toolbar {
  padding: 10px;
}

.email-body {
  min-height: 220px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  line-height: 1.55;
}

.opportunities-page,
.opportunities-content {
  display: grid;
  gap: 14px;
}

.opportunities-placeholder {
  min-height: 280px;
  align-content: start;
}

.muted-copy {
  color: var(--muted);
}

.settings-status {
  margin: 0;
  border: 1px solid #c2b490;
  border-radius: 8px;
  background: #f4f1e8;
  color: #526f5b;
  padding: 9px 10px;
  font-size: 0.88rem;
  font-weight: 800;
}

.settings-page {
  display: grid;
  gap: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

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

.settings-index-card {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.settings-index-card:hover {
  border-color: #c2b490;
  box-shadow: 0 10px 24px rgba(40, 36, 28, 0.1);
  transform: translateY(-1px);
}

.settings-index-card span:first-child {
  display: grid;
  gap: 6px;
}

.settings-index-card strong {
  font-size: 1.02rem;
}

.settings-index-card small {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.45;
}

.settings-subpage {
  grid-template-columns: minmax(0, 1fr);
}

.settings-subpage-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.settings-subpage-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.settings-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.settings-panel-wide {
  grid-column: 1 / -1;
}

.site-credit {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.admin-portal .site-credit {
  margin-top: 24px;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.settings-form input,
.settings-form select,
.settings-table select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px;
}

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

.settings-sync-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.settings-sync-list p {
  margin: 4px 0 0;
  color: var(--muted);
}

.settings-sync-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.storage-provider-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.storage-provider-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.storage-provider-grid strong {
  display: block;
  margin-bottom: 6px;
}

.storage-provider-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.settings-table th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 900;
}

.settings-table small {
  color: var(--muted);
}

.access-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.access-mode-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.access-mode-card.active {
  border-color: #c2b490;
  background: var(--green-soft);
}

.access-mode-card strong {
  display: block;
  margin-bottom: 6px;
}

.access-mode-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.user-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.smtp-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.smtp-form .composer-actions,
.smtp-form .muted-copy {
  grid-column: 1 / -1;
}

.tag,
.hot-tag,
.activity-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--green-soft);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.hot-tag {
  background: #f3ecd8;
  color: var(--amber);
}

.activity-tag {
  background: var(--green-soft);
  color: var(--blue);
}

.form-stack,
.dialog-form,
.workflow-stage-list {
  display: grid;
  gap: 12px;
}

.form-stack label,
.dialog-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.form-stack input,
.form-stack select,
.dialog-form input,
.dialog-form select {
  height: 40px;
  padding: 0 10px;
  font-weight: 500;
}

.activities-page {
  display: grid;
  gap: 12px;
}

.activities-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.activity-view-toggle,
.activity-toolbar-actions,
.activity-type-tabs,
.activity-date-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.activity-filter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.activity-filter-panel[hidden] {
  display: none;
}

.activity-filter-panel .secondary-action {
  width: fit-content;
}

.secondary-action.active-filter {
  border-color: #c2b490;
  background: var(--green-soft);
  color: var(--blue);
}

.activity-view-toggle .icon-button.active {
  border-color: #c2b490;
  background: var(--green-soft);
  color: var(--blue);
}

.activity-quick-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 720px;
  min-width: min(100%, 680px);
}

.activity-quick-form input,
.activity-quick-form select {
  height: 40px;
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
}

.activity-quick-form input[name="title"] {
  flex: 1 1 240px;
  min-width: 220px;
}

.activity-toolbar-actions {
  margin-left: auto;
  color: var(--muted);
  font-weight: 800;
}

.activity-type-tabs button,
.activity-date-tabs button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 9px;
  background: var(--green-soft);
  color: var(--blue);
  font-weight: 800;
}

.activity-date-tabs {
  justify-content: flex-end;
}

.activity-date-tabs button {
  background: transparent;
  color: var(--ink);
}

.activity-type-tabs button.active,
.activity-date-tabs button.active {
  background: #e4decd;
  color: var(--blue);
}

.activity-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.activity-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.activity-table th,
.activity-table td {
  height: 32px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 9px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.activity-table th {
  color: var(--ink);
  background: var(--surface-soft);
  font-weight: 900;
}

.activity-table th:first-child,
.activity-table td:first-child,
.activity-table th:nth-child(2),
.activity-table td:nth-child(2) {
  width: 40px;
  text-align: center;
}

.activity-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

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

.activity-table tr.done td {
  color: #8a95a6;
  text-decoration: line-through;
}

.activity-subject {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.activity-type-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
}

.activity-cell-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  background: var(--surface);
}

.activity-calendar-wrap {
  display: grid;
  gap: 10px;
}

.activity-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
}

.activity-calendar-header h3 {
  margin: 0;
}

.activity-calendar-header span {
  color: var(--muted);
  font-weight: 800;
}

.activity-calendar-weekdays,
.activity-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.activity-calendar-weekdays {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.activity-calendar-weekdays span {
  padding: 0 8px;
}

.activity-calendar-grid {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.activity-calendar-day {
  min-height: 118px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
}

.activity-calendar-day.muted {
  background: var(--surface-soft);
}

.activity-calendar-day.today {
  box-shadow: inset 0 0 0 2px #c2b490;
}

.calendar-day-items {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.calendar-activity {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 1px solid #d5cebb;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--blue);
  padding: 5px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-activity.done {
  color: #8a95a6;
  text-decoration: line-through;
}

.calendar-more {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-type-manager {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.activity-type-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
}

.activity-type-row input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

.locked-type {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

dialog {
  width: min(540px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(18, 16, 12, 0.3);
  padding: 0;
}

dialog::backdrop {
  background: rgba(37, 37, 32, 0.58);
}

.dialog-form {
  padding: 20px;
}

.dialog-header {
  justify-content: space-between;
  gap: 18px;
}

.deal-detail-page {
  display: grid;
  gap: 16px;
}

.deal-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.deal-detail-header h3 {
  margin: 0;
  font-size: 1.45rem;
}

.deal-detail-header p:not(.panel-label) {
  margin: 4px 0 0;
  color: var(--muted);
}

.deal-stage-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.deal-stage-step {
  min-width: 110px;
  min-height: 26px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  border: 0;
  color: #5f574f;
  background: #dcd6c7;
  font-size: 0.78rem;
  font-weight: 800;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  cursor: pointer;
}

.deal-stage-step:hover,
.deal-stage-step:focus-visible {
  filter: brightness(0.96);
  outline: 2px solid rgba(130, 113, 110, 0.45);
  outline-offset: 2px;
}

.deal-stage-step.complete {
  color: #fffdf7;
  background: var(--green);
}

.deal-detail-grid {
  display: grid;
  grid-template-columns: 470px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 190px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f0eee4;
  box-shadow: var(--shadow-soft);
}

.deal-fields-panel {
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.field-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
}

.field-filter input {
  width: 100%;
  height: 36px;
  border: 0;
  outline: 0;
}

.deal-field-group {
  border-top: 1px solid var(--line);
  padding: 18px 16px;
}

.field-group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.field-group-heading h3 {
  margin: 0;
  font-size: 1rem;
}

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

.field-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.field-row span {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.field-row strong {
  color: var(--blue);
  font-weight: 700;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.link-button:hover,
.link-button:focus-visible {
  text-decoration: underline;
}

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

.participant-list {
  display: grid;
  gap: 8px;
}

.participant-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.participant-info {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.participant-pill small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.mini-button.slim {
  min-height: 28px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.record-detail-page {
  display: grid;
  gap: 16px;
}

.record-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.record-detail-header h3 {
  margin: 0;
  font-size: 1.5rem;
}

.record-detail-header p:not(.panel-label) {
  margin: 4px 0 0;
  color: var(--muted);
}

.record-detail-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 16px;
}

.record-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.record-row-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.record-row-button span {
  color: var(--muted);
}

.spaced-label {
  margin-top: 22px;
}

.deal-activity-panel {
  padding: 22px 16px 32px;
  overflow: auto;
}

.drawer-stat-grid {
  align-items: stretch;
  gap: 10px;
}

.drawer-stat {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.drawer-stat strong {
  display: block;
  margin-top: 4px;
}

.detail-section {
  margin-top: 18px;
}

.detail-section h3 {
  margin: 0 0 4px;
}

.detail-section p {
  margin: 4px 0 0;
  color: var(--muted);
}

.activity-composer {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.activity-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
}

.activity-tabs button,
.history-tabs button,
.activity-input {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.activity-tabs button {
  min-height: 42px;
  font-weight: 700;
}

.activity-tabs button.active {
  color: var(--blue);
  border-bottom: 2px solid var(--blue);
}

.activity-input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  text-align: left;
}

.activity-compose-form {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.activity-compose-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.activity-compose-form input,
.activity-compose-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  resize: vertical;
}

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

.focus-block,
.history-block {
  margin-top: 28px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.focus-empty {
  min-height: 130px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.focus-empty strong {
  color: var(--ink);
}

.focus-empty p {
  max-width: 420px;
  margin: 0;
}

.deal-follow-up-list {
  width: min(100%, 620px);
  display: grid;
  gap: 10px;
  text-align: left;
}

.deal-follow-up-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
}

.deal-follow-up-item strong {
  display: block;
}

.deal-follow-up-item p {
  max-width: none;
  margin-top: 4px;
}

.history-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.history-tabs button {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-weight: 800;
}

.history-tabs button.active {
  background: var(--green-soft);
  color: var(--blue);
}

.history-timeline {
  display: grid;
  gap: 14px;
  position: relative;
}

.history-timeline::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  border-left: 2px dashed #d5cebb;
}

.history-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  position: relative;
}

.history-icon {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  z-index: 1;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.history-card.expanded {
  border-color: #c2b490;
  box-shadow: 0 8px 22px rgba(40, 36, 28, 0.1);
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.history-card h4 {
  margin: 0;
  font-size: 1rem;
}

.history-card p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-card > p {
  color: var(--ink);
  margin-top: 10px;
}

.history-actions {
  flex: 0 0 auto;
}

.history-detail {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.deal-chip-row .link-button {
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--green-soft);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-line {
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid #acb7ae;
  padding: 8px 0 8px 12px;
}

.workflow-stage-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.workflow-stage-row input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

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

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--green);
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric-grid,
  .content-grid,
  .task-layout,
  .storage-provider-grid {
    grid-template-columns: 1fr 1fr;
  }

  .activity-quick-form {
    flex-basis: 100%;
  }
}

@media (max-width: 760px) {
  .main-content,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .section-header,
  .deal-detail-header,
  .record-detail-header,
  .pipeline-toolbar,
  .pipeline-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 100%;
  }

  .workspace-select {
    max-width: none;
    width: 100%;
  }

  .nav-list,
  .metric-grid,
  .content-grid,
  .deal-detail-grid,
  .record-detail-grid,
  .task-layout,
  .storage-provider-grid {
    grid-template-columns: 1fr;
  }

  .activity-quick-form,
  .activities-toolbar,
  .activity-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .activity-quick-form,
  .activity-quick-form input,
  .activity-quick-form select,
  .activity-quick-form button {
    width: 100%;
    min-width: 0;
  }

  .deal-fields-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .field-row span {
    text-align: left;
  }

  .segmented-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .pipeline-board {
    grid-template-columns: repeat(5, minmax(250px, 84vw));
  }

  .stage-summary {
    grid-template-columns: 1fr;
  }

  .workflow-stage-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .workflow-stage-row input {
    grid-column: 1 / -1;
  }
}
