:root {
  color-scheme: light;
  --bg: #08080a;
  --panel: #151519;
  --panel-2: #222228;
  --text: #f6f6f7;
  --muted: #b8b8c0;
  --line: #32323a;
  --green: #c9162d;
  --green-2: #fff0f2;
  --blue: #0b0b0d;
  --blue-2: #23232a;
  --red: #c9162d;
  --red-2: #ffe8ec;
  --amber: #5b101a;
  --amber-2: #301820;
  --ink: #ffffff;
  --dark: #0b0b0d;
  --dark-2: #151518;
  --accent: #e11937;
  --accent-deep: #8f1020;
  --card: #1b1b20;
  --card-2: #24242b;
  --control: #101014;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 10%, rgba(225, 25, 55, 0.18), transparent 30%),
    linear-gradient(120deg, #070708, #151519 48%, #250a12),
    var(--bg);
  color: var(--text);
  font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

body::before {
  animation: signalSweep 13s linear infinite;
  background: linear-gradient(90deg, transparent, rgba(225, 25, 55, 0.18), transparent);
  content: "";
  height: 2px;
  left: -35vw;
  pointer-events: none;
  position: fixed;
  top: 90px;
  transform: rotate(-6deg);
  width: 70vw;
  z-index: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 28px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: linear-gradient(150deg, rgba(225, 25, 55, 0.16), transparent 42%), var(--panel);
  border: 1px solid rgba(225, 25, 55, 0.3);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 26px;
  margin: 0 auto;
  max-width: 430px;
  padding: 28px;
  width: min(100%, 430px);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.sidebar {
  background: linear-gradient(160deg, rgba(225, 25, 55, 0.2), transparent 34%), var(--dark);
  border-right: 1px solid #232329;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(225, 25, 55, 0.35);
  color: #ffffff;
  display: grid;
  font-weight: 800;
  height: 46px;
  justify-items: center;
  width: 46px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.dialog-head h3,
.dialog-head p {
  margin: 0;
}

.brand h1 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.nav-item,
.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.chip {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
}

.nav-item {
  align-items: center;
  background: transparent;
  color: #b7b7be;
  display: flex;
  gap: 11px;
  padding: 0 12px;
  text-align: left;
  width: 100%;
}

.nav-item span:first-child {
  display: inline-grid;
  font-size: 18px;
  height: 24px;
  place-items: center;
  width: 24px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(225, 25, 55, 0.14);
  border-color: rgba(225, 25, 55, 0.38);
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.sidebar-note {
  color: #9b9ba3;
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
}

.main {
  background:
    radial-gradient(circle at 18% 8%, rgba(225, 25, 55, 0.18), transparent 30%),
    linear-gradient(145deg, #111114 0%, #19191d 48%, #2a1017 100%);
  border-left: 1px solid #24242a;
  color: #ffffff;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  padding: 20px;
  position: relative;
}

.main::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(180deg, black, transparent 82%);
  pointer-events: none;
  position: absolute;
}

.main::after {
  animation: floatBars 16s ease-in-out infinite alternate;
  background:
    linear-gradient(180deg, rgba(225, 25, 55, 0.36), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
  clip-path: polygon(0 0, 100% 10%, 92% 100%, 8% 90%);
  content: "";
  height: 220px;
  opacity: 0.28;
  pointer-events: none;
  position: absolute;
  right: 34px;
  top: 128px;
  width: 54px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.topbar h2 {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.15;
  color: #ffffff;
}

.top-actions,
.capture-input,
.chips {
  align-items: center;
  display: flex;
  gap: 10px;
}

.search-wrap {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(9, 9, 12, 0.18);
  color: #ffffff;
  display: flex;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  width: min(360px, 35vw);
}

.search-wrap input,
.capture-input input {
  background: transparent;
  border: 0;
  color: inherit;
  min-width: 0;
  outline: 0;
  width: 100%;
}

.search-wrap input::placeholder,
.capture-input input::placeholder {
  color: rgba(255, 255, 255, 0.64);
}

.primary-button {
  background: linear-gradient(145deg, var(--dark), var(--accent-deep));
  border-color: #0b0b0d;
  box-shadow: 0 12px 26px rgba(9, 9, 12, 0.18);
  color: #ffffff;
  padding: 0 16px;
}

.secondary-button,
.icon-button,
.chip {
  background: var(--card-2);
  border-color: var(--line);
  color: var(--text);
  padding: 0 14px;
}

.danger-button {
  background: var(--red);
  color: #ffffff;
  padding: 0 14px;
}

.wide {
  align-items: center;
  display: flex;
  gap: 9px;
  justify-content: center;
  width: 100%;
}

.quick-capture {
  background: linear-gradient(135deg, rgba(11, 11, 13, 0.96), rgba(33, 18, 22, 0.96)), var(--dark);
  border: 1px solid #24242a;
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(9, 9, 12, 0.22);
  color: #ffffff;
  margin-bottom: 14px;
  overflow: hidden;
  padding: 14px;
  position: relative;
}

.quick-capture::before {
  animation: commandRail 10s linear infinite;
  background: repeating-linear-gradient(90deg, transparent 0 18px, rgba(225, 25, 55, 0.55) 18px 22px);
  content: "";
  height: 3px;
  left: 0;
  opacity: 0.7;
  position: absolute;
  right: 0;
  top: 0;
}

.capture-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  min-height: 50px;
  padding: 5px 6px;
}

.mic-button {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  display: grid;
  flex: 0 0 40px;
  height: 40px;
  place-items: center;
}

.mic-button.listening {
  animation: pulse 1s infinite;
  background: var(--red);
  color: #ffffff;
}

@keyframes pulse {
  50% {
    transform: scale(0.94);
  }
}

@keyframes commandRail {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 220px 0;
  }
}

@keyframes signalSweep {
  0% {
    transform: translateX(0) rotate(-6deg);
  }
  100% {
    transform: translateX(170vw) rotate(-6deg);
  }
}

@keyframes dataDrift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 260px 0;
  }
}

@keyframes floatBars {
  from {
    transform: translateY(0) skewX(-10deg);
  }
  to {
    transform: translateY(34px) skewX(-10deg);
  }
}

@keyframes statusFlow {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.chips {
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  min-height: 32px;
}

.view {
  display: none;
}

.active-view {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(8, 8, 10, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 70px rgba(0, 0, 0, 0.22);
  display: block;
  min-height: calc(100vh - 184px);
  padding: 14px;
  position: relative;
  z-index: 1;
}

.active-view::before {
  animation: dataDrift 18s linear infinite;
  background:
    linear-gradient(90deg, transparent, rgba(225, 25, 55, 0.12), transparent),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(255, 255, 255, 0.045) 38px 40px);
  content: "";
  inset: 0;
  opacity: 0.55;
  pointer-events: none;
  position: absolute;
}

.active-view > * {
  position: relative;
  z-index: 1;
}

.metric-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  margin-bottom: 12px;
}

.metric {
  background: linear-gradient(155deg, var(--card), #111116);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 14px;
  position: relative;
}

.metric-button {
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
}

.metric-button:hover,
.metric-button:focus-visible {
  border-color: rgba(255, 59, 59, 0.76);
  transform: translateY(-1px);
}

.metric-button.active-metric {
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(255, 25, 55, 0.2);
}

.metric::before,
.panel::before {
  animation: statusFlow 7s linear infinite;
  background: linear-gradient(90deg, transparent, rgba(225, 25, 55, 0.75), transparent);
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.1;
  margin-top: 6px;
}

.content-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.panel {
  background: linear-gradient(155deg, var(--card), #121217);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(9, 9, 12, 0.06);
  overflow: hidden;
  padding: 14px;
  position: relative;
}

.metric-detail-panel {
  margin-bottom: 12px;
}

.metric-detail-row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

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

.panel h3 {
  font-size: 17px;
  font-weight: 900;
  margin: 0;
}

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

.template-workspace {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}

.template-list {
  display: grid;
  gap: 12px;
}

.template-variable-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
  position: sticky;
  top: 14px;
}

.template-variable-panel label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  text-transform: uppercase;
}

.template-variable-panel select {
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 38px;
  padding: 0 10px;
}

.template-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.template-card textarea {
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 96px;
  padding: 9px 10px;
  resize: vertical;
}

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

.format-button {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  height: 34px;
  width: 34px;
}

.format-button.bold {
  font-weight: 900;
}

.format-button.italic {
  font-style: italic;
}

.format-button.strike {
  text-decoration: line-through;
}

.variable-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variable-list.compact {
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.variable-chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  min-height: 32px;
  padding: 0 10px;
}

.variable-chip:hover {
  background: var(--text);
  color: var(--panel);
}

.task-card {
  background: linear-gradient(155deg, var(--card), #111116);
  border: 1px solid var(--line);
  border-left: 5px solid var(--dark);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(9, 9, 12, 0.05);
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.task-card.overdue {
  border-left-color: var(--accent);
}

.task-card.due-soon {
  border-left-color: var(--accent-deep);
}

.task-card.reminder-due {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.task-card.completed {
  opacity: 0.72;
}

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

.task-title {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.task-meta,
.task-note,
.mini {
  color: var(--muted);
  font-size: 13px;
}

.task-note {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  min-height: 24px;
  padding: 0 9px;
}

.badge.green {
  background: var(--dark);
  color: #ffffff;
}

.badge.blue {
  background: var(--blue-2);
  color: #ffffff;
}

.badge.red {
  background: var(--red);
  color: #ffffff;
}

.badge.amber {
  background: var(--amber-2);
  color: #ffffff;
}

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

.filters select,
.filters input {
  background: var(--control);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
}

.calendar-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.day-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 120px;
  padding: 10px;
}

.day-cell.today {
  outline: 2px solid var(--accent);
}

.day-num {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.day-task {
  background: var(--panel-2);
  border-radius: 6px;
  color: #ffffff;
  display: block;
  font-size: 12px;
  margin-top: 6px;
  overflow: hidden;
  padding: 5px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.board-column {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 320px;
  padding: 12px;
}

.board-column h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.report-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.report-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.briefing-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.briefing-list div {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.briefing-list strong,
.briefing-list span {
  display: block;
}

.briefing-list strong {
  font-size: 24px;
}

.briefing-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}


.contacts-toolbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 12px 0;
}

.contact-search {
  width: min(520px, 100%);
}

.contact-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.contact-row {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 9px 12px;
}

.contact-main {
  min-width: 0;
}

.contact-name {
  display: inline-block;
  font-size: 15px;
  margin-bottom: 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.contact-meta a {
  color: #ffffff;
  font-weight: 800;
}

.subtle-line {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.contact-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.contact-actions .secondary-button {
  margin-bottom: 0;
  min-height: 34px;
  padding: 0 10px;
}
.client-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

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

.message-select {
  align-items: center;
  display: grid;
  gap: 6px;
}

.message-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.link-button {
  align-items: center;
  display: inline-flex;
  min-height: 36px;
  text-decoration: none;
}

.master-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 10px;
}

.compact-form {
  display: grid;
  gap: 14px;
}

.checkbox-field input {
  justify-self: start;
  min-height: 20px;
  width: 20px;
}

.report-card h3 {
  margin: 0 0 12px;
}

.bar {
  background: #2b2b32;
  border-radius: 999px;
  height: 10px;
  margin: 8px 0 14px;
  overflow: hidden;
}

.bar span {
  background: linear-gradient(90deg, var(--dark), var(--accent));
  display: block;
  height: 100%;
}

.empty-state {
  align-items: center;
  border: 1px dashed #4a4a54;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  justify-items: center;
  min-height: 130px;
  padding: 20px;
  text-align: center;
}

dialog {
  background: var(--card);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  max-width: min(860px, calc(100vw - 24px));
  padding: 0;
  width: 860px;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.task-form {
  padding: 18px;
}

.dialog-head,
.dialog-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.dialog-head {
  border-bottom: 1px solid var(--line);
  margin: -18px -18px 16px;
  padding: 16px 18px;
}

.dialog-head h3 {
  font-size: 22px;
}

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

label,
.field-block {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  text-transform: uppercase;
}

label.full,
.field-block.full {
  grid-column: 1 / -1;
}

.paired-fields {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.8fr);
}

.paired-fields > label {
  min-width: 0;
}

.paired-fields span {
  line-height: 1.2;
  white-space: normal;
}
.field-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.field-head span {
  margin: 0;
}

.inline-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 0;
  text-transform: uppercase;
}

.inline-link:hover,
.inline-link:focus-visible {
  color: var(--accent-2);
  text-decoration: underline;
}

label input,
label select,
label textarea,
.field-block input,
.field-block select,
.field-block textarea {
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 42px;
  min-width: 0;
  padding: 9px 10px;
  text-transform: none;
  width: 100%;
}

label input::placeholder,
label textarea::placeholder {
  color: #858590;
}

select option {
  background: var(--control);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  margin: 16px -18px -18px;
  padding: 14px 18px;
}

.spacer {
  flex: 1;
}

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

  .sidebar {
    height: auto;
    position: static;
  }

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

  .content-grid,
  .report-grid,
  .board-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .main {
    padding: 14px;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    gap: 14px;
    padding: 14px;
  }

  .brand-mark {
    height: 40px;
    width: 40px;
  }

  .topbar,
  .top-actions,
  .capture-input {
    align-items: stretch;
    flex-direction: column;
  }

  .search-wrap,
  .top-actions,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .nav,
  .metric-grid,
  .form-grid,
  .paired-fields,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    background: var(--dark);
    border-top: 1px solid #232329;
    bottom: 0;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(7, 1fr);
    left: 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 20;
  }

  .nav-item {
    display: grid;
    gap: 2px;
    justify-items: center;
    min-height: 56px;
    padding: 4px;
    text-align: center;
  }

  .nav-item span:first-child {
    height: 22px;
    width: 22px;
  }

  .nav-item span:last-child {
    font-size: 11px;
  }

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

  .day-cell {
    min-height: 90px;
  }

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

  .contacts-toolbar,
  .contact-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .contacts-toolbar {
    flex-direction: column;
  }

  .contact-actions {
    justify-content: flex-start;
  }

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

  dialog {
    height: min(92vh, 820px);
  }

  .task-form {
    max-height: 92vh;
    overflow: auto;
  }
}

@media (max-width: 900px) {
  .template-workspace {
    grid-template-columns: 1fr;
  }

  .template-variable-panel {
    position: static;
  }
}
