:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #eef3f2;
  --ink: #17211f;
  --muted: #65726f;
  --line: #d9e1df;
  --teal: #087f77;
  --teal-soft: #dff3ef;
  --blue: #2563a8;
  --blue-soft: #e1ecf8;
  --orange: #b85f16;
  --orange-soft: #ffe9d2;
  --pink: #b53a64;
  --pink-soft: #fae1e9;
  --green: #2f7d32;
  --green-soft: #e0f0dd;
  --danger: #b42318;
  --danger-soft: #ffe2df;
  --shadow: 0 16px 46px rgba(23, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aab8b5;
}

button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

button.ghost {
  background: transparent;
}

button.compact {
  min-height: 34px;
  padding: 0 10px;
}

button.wide {
  width: 100%;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 360px;
}

.toast:not(:empty) {
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  padding: 48px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand-lockup,
.brand-mini {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.mark.small {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  max-width: 360px;
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

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

.login-aside {
  display: grid;
  place-items: center;
  padding: 48px;
  background:
    linear-gradient(90deg, rgba(8, 127, 119, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(8, 127, 119, 0.08) 1px, transparent 1px),
    #f2f6f5;
  background-size: 42px 42px;
}

.sheet-preview {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.sheet-row:last-child {
  border-bottom: 0;
}

.sheet-row.header {
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.sheet-row.urgent {
  background: var(--danger-soft);
}

.sheet-row.done {
  background: var(--green-soft);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  font-size: 13px;
}

.sidebar .brand-mini strong {
  font-size: 13px;
}

.sidebar .mark.small {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.nav-list button {
  padding: 6px 10px;
  font-size: 13px;
  min-height: 32px;
}

.brand-mini span,
.account-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

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

.nav-list button {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  background: transparent;
}

.nav-list button.active {
  background: var(--surface-strong);
  border-color: #bfcdca;
  font-weight: 800;
}

.nav-list button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff1111;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.urgent-btn {
  background: #ff1111 !important;
  border-color: #ff1111 !important;
  color: #fff !important;
  font-weight: 800;
  animation: urgent-pulse 2.4s ease-in-out infinite;
}

@keyframes urgent-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 17, 17, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 17, 17, 0); }
}

.extras-shell {
  display: grid;
  gap: 14px;
}

.extras-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

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

.extras-header h2 {
  margin: 4px 0 0;
}

.extras-header small {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

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

.extra-card {
  border: 2px solid #ff1111;
  border-radius: 10px;
  background: #fff5f5;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.extra-card.overdue {
  background: #ffe5e5;
  animation: overdue-flash 2s ease-in-out infinite;
}

@keyframes overdue-flash {
  0%, 100% { border-color: #ff1111; }
  50%      { border-color: #7a0000; }
}

.extra-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.extra-card h3 {
  font-size: 15px;
  margin: 0;
  color: #111;
}

.extra-card .extra-firm {
  font-weight: 800;
  color: #1a1a1a;
  margin: 0;
  font-size: 14px;
}

.extra-card .extra-desc {
  color: #444;
  font-size: 13px;
  margin: 0;
  line-height: 1.35;
}

.extra-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.extras-done {
  margin-top: 8px;
}

.extras-done summary {
  cursor: pointer;
  padding: 8px 0;
  font-weight: 700;
  color: var(--muted);
}

.pill.urgent {
  background: #ff1111;
  color: #fff;
}

.pill.danger {
  background: #7a0000;
  color: #fff;
}

.account-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.account-card span {
  font-weight: 800;
}

.workspace {
  min-width: 0;
  padding: 12px 14px 14px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar h2 {
  font-size: 18px;
  margin: 0;
}

.topbar .eyebrow {
  font-size: 10px;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

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

body.sidebar-open .sidebar-backdrop {
  display: block;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

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

.stat-card,
.panel,
.task-card,
.client-card,
.team-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

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

.status-bars,
.workload-list,
.urgent-list,
.notice-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-strong);
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: var(--teal);
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sheet-filters {
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  align-items: end;
}

.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.task-board {
  min-width: 0;
}

.sheet-board {
  display: grid;
  gap: 8px;
}

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

.month-mode.archive {
  border-color: #e4b25e;
  background: #fff9ec;
}

.month-mode strong {
  display: block;
  font-size: 16px;
}

.month-mode small {
  color: var(--muted);
  font-weight: 700;
}

.month-archive-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.month-archive-tabs > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.month-archive-tabs em {
  color: var(--muted);
  font-size: 12px;
}

.month-archive-tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.sheet-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sheet-summary h3 {
  font-size: 14px;
  margin: 0;
}

.sheet-mini-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.active-workers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.active-workers.empty em {
  font-style: italic;
  color: var(--muted);
  font-size: 12px;
}

.workers-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.worker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.worker-chip:hover {
  background: #d9eae8;
  border-color: #9bb9b5;
}

.worker-chip .worker-name {
  font-weight: 800;
}

.worker-chip .worker-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--teal, #2a8d83);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.note-readonly,
.sheet-cell-readonly {
  display: inline-block;
  width: 100%;
  padding: 3px 6px;
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-cell-wrap.readonly {
  cursor: not-allowed;
  opacity: 0.95;
}

.note-cell .note-readonly {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 27px;
  padding: 6px 4px;
  background: #fff;
}

.worker-tasks {
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow: auto;
}

.worker-stats {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.worker-stats strong {
  color: var(--ink);
  font-size: 16px;
  margin-right: 4px;
}

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

.worker-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.worker-task:hover {
  background: var(--surface-strong);
}

.worker-task.urgent {
  border-left: 3px solid #ff1111;
}

.worker-task.overdue {
  background: #fff5f5;
}

.worker-task-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.worker-task-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.worker-task-side small {
  color: var(--muted);
  font-size: 11px;
}

.sheet-mini-counts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sheet-mini-counts strong {
  color: var(--ink);
}

.sheet-scroll {
  max-height: calc(100vh - 130px);
  overflow: auto;
  border: 1px solid #111;
  background: #fff;
}

.agency-sheet {
  width: max-content;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  table-layout: fixed;
}

.agency-sheet th,
.agency-sheet td {
  width: 130px;
  min-width: 130px;
  height: 28px;
  padding: 0;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  background: #fff;
}

.agency-sheet thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 24px;
  padding: 0 3px;
  background: #f1f3f4;
  color: #111;
  font-size: 9px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.agency-sheet .firm-col,
.agency-sheet .firm-name {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 150px;
  width: 150px;
  border-left: 1px solid #111;
  background: #eef0f0;
}

.agency-sheet .firm-name {
  z-index: 2;
  text-align: left;
}

.agency-sheet .firm-name button {
  display: block;
  width: 100%;
  min-height: 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 6px;
  color: #333;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agency-sheet .note-col,
.agency-sheet .note-cell {
  min-width: 70px;
  width: 70px;
}

.note-cell button,
.sheet-cell-wrap {
  display: block;
  width: 100%;
  min-height: 27px;
  height: 27px;
  border: 0;
  border-radius: 0;
  padding: 3px 6px;
  color: #111;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-cell-wrap {
  position: relative;
}

.sheet-cell {
  display: block;
  width: 100%;
  min-height: 27px;
  height: 27px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 3px 6px;
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paint-cell {
  display: none;
}

.paint-cell:hover {
  border-color: #111;
  background: #fff;
  outline: 2px solid #111;
  outline-offset: 1px;
}

.note-cell button {
  background: #fff;
}

textarea.sheet-cell {
  resize: none;
  outline: 0;
}

.status-blank {
  background: #fff;
}

.status-red {
  background: #ff1111;
  color: #fff;
}

.status-yellow {
  background: #ffff00;
  color: #111;
}

.status-cyan {
  background: #13e7e7;
  color: #111;
}

.status-green {
  background: #00f000;
  color: #111;
}

.sheet-cell:hover,
.sheet-cell:focus,
.note-cell button:hover,
.agency-sheet .firm-name button:hover {
  outline: 2px solid #111;
  outline-offset: -2px;
}

.sheet-legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 28px;
  padding: 18px 0;
}

.legend-block {
  display: grid;
  min-height: 64px;
  place-items: center;
  border: 1px solid #111;
  border-radius: 0;
  font-size: 14px;
  font-weight: 900;
}

.legend-block.active {
  box-shadow: 0 0 0 4px #111 inset;
}

.sheet-context-menu {
  position: fixed;
  z-index: 50;
  display: grid;
  min-width: 210px;
  overflow: hidden;
  border: 1px solid #111;
  background: #fff;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.sheet-context-menu button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  padding: 0 10px;
  text-align: left;
}

.sheet-context-menu button:last-child {
  border-bottom: 0;
}

.sheet-context-menu button:hover {
  background: #f1f3f4;
}

.context-color {
  width: 18px;
  height: 18px;
  border: 1px solid #111;
}

.task-flow,
.task-list {
  min-width: 0;
}

.task-flow header,
.task-list-toolbar {
  margin-bottom: 14px;
}

.count {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 800;
}

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

.flow-step {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
}

.flow-step span:first-child {
  display: grid;
  gap: 3px;
}

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

.flow-step.active {
  border-color: rgba(8, 127, 119, 0.35);
  background: var(--teal-soft);
}

.task-list-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.task-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-table-head,
.task-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 96px 68px 92px 250px;
  gap: 10px;
  align-items: center;
}

.task-table-head {
  padding: 11px 14px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.task-row {
  position: relative;
  padding: 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.task-row.is-urgent {
  background: linear-gradient(90deg, var(--danger-soft), #fff 130px);
}

.task-main,
.task-owner,
.task-due,
.task-state {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.task-main .task-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-title-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  border-radius: 8px;
  padding: 3px 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.pill.pink {
  background: var(--pink-soft);
  color: var(--pink);
}

.pill.green {
  background: var(--green-soft);
  color: var(--green);
}

.task-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 0;
}

.latest-note {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-owner > span:not(.pill),
.task-due span,
.task-state span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}

.task-state {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--teal);
}

.task-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.task-controls.claim-only {
  grid-template-columns: 1fr;
}

.task-controls select {
  min-height: 36px;
  min-width: 0;
  padding-block: 6px;
}

.icon-btn {
  display: grid;
  width: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  font-size: 18px;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

.client-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.client-card,
.team-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.client-card {
  width: 100%;
  min-height: 124px;
  text-align: left;
}

.client-card.active {
  border-color: rgba(8, 127, 119, 0.35);
  background: var(--teal-soft);
}

.client-card header,
.team-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.client-card strong,
.team-card strong {
  font-size: 16px;
}

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

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

.danger-btn {
  background: #ff1111 !important;
  border-color: #ff1111 !important;
  color: #fff !important;
  font-weight: 800;
}

.danger-btn:hover {
  background: #d40000 !important;
  border-color: #d40000 !important;
}

.voice-picker {
  display: grid;
  gap: 12px;
  max-height: 70vh;
  overflow: auto;
}

.voice-picker label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.voice-id-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.voice-id-row input {
  flex: 1;
}

.voice-current {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-strong);
  border-radius: 8px;
  font-size: 12px;
}

.voice-current code {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
}

.voice-suggestions strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

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

.voice-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.voice-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.voice-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.client-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.client-metrics .stat-card {
  padding: 12px;
}

.client-metrics .stat-card strong {
  font-size: 22px;
}

.notice-item {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 10px;
  text-align: left;
}

.notice-item span {
  color: var(--muted);
  font-size: 12px;
}

.mini-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}

.mini-item strong {
  font-size: 13px;
}

.mini-item span {
  color: var(--muted);
  font-size: 12px;
}

.modal {
  width: min(780px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.detail-modal {
  width: min(980px, calc(100vw - 32px));
}

.detail-content {
  display: grid;
  gap: 14px;
  padding: 18px;
  max-height: min(76vh, 760px);
  overflow: auto;
}

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

.panel-lite {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.panel-lite p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-section header,
.calendar-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.file-list,
.revision-list {
  display: grid;
  gap: 8px;
}

.file-item,
.revision-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.file-item span,
.revision-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.inline-form,
.approval-link-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.approval-link-row {
  grid-template-columns: 1fr auto;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
}

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

.calendar-grid > strong {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.calendar-cell {
  min-height: 122px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.calendar-cell.empty {
  background: transparent;
  border-style: dashed;
}

.calendar-cell.today {
  border-color: rgba(8, 127, 119, 0.45);
  background: var(--teal-soft);
}

.calendar-cell.has-special-day {
  background: #fffaf0;
}

.calendar-cell.today.has-special-day {
  background: linear-gradient(135deg, var(--teal-soft), #fffaf0);
}

.calendar-day {
  font-weight: 800;
}

.calendar-special {
  display: block;
  border-radius: 6px;
  padding: 5px 6px;
  background: #fff4d6;
  color: #7a4c00;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.calendar-special.resmi,
.calendar-special.milli {
  background: #ffe2df;
  color: #a82016;
}

.calendar-special.dini {
  background: #e2f4ea;
  color: #1f6d3a;
}

.calendar-task {
  min-height: 30px;
  overflow: hidden;
  padding: 4px 7px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-task.urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.special-days-panel {
  position: sticky;
  top: 18px;
}

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

.special-day-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid #d89a00;
  border-radius: 8px;
  background: #fffaf0;
}

.special-day-item.resmi,
.special-day-item.milli {
  border-left-color: var(--danger);
  background: #fff7f6;
}

.special-day-item.dini {
  border-left-color: var(--green);
  background: #f4fbf6;
}

.special-day-item strong {
  color: var(--ink);
  font-size: 13px;
}

.special-day-item span {
  font-weight: 800;
}

.special-day-item small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-table {
  display: grid;
  gap: 8px;
}

.report-table > div {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 120px 90px 110px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-table span {
  color: var(--muted);
  font-size: 13px;
}

.approval-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.approval-card {
  display: grid;
  gap: 18px;
  width: min(820px, 100%);
}

.approval-content {
  display: grid;
  gap: 14px;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.modal::backdrop {
  background: rgba(23, 33, 31, 0.35);
}

.modal form {
  display: grid;
}

.modal header,
.modal footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

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

.span-2 {
  grid-column: span 2;
}

@media (max-width: 1360px) {
  .task-board {
    grid-template-columns: 1fr;
  }

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

  .flow-step {
    min-height: 74px;
    align-items: flex-start;
  }
}

@media (max-width: 1120px) {
  .task-table-head {
    display: none;
  }

  .task-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

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

  .client-layout,
  .calendar-layout,
  .detail-grid,
  .inline-form,
  .report-table > div {
    grid-template-columns: 1fr;
  }

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

  .calendar-grid > strong {
    display: none;
  }

  .calendar-cell.empty {
    display: none;
  }

  .filters,
  .sheet-filters {
    grid-template-columns: 1fr;
  }

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

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

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 50;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.12);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .workspace {
    padding: 10px 12px 12px;
  }

  .topbar h2 {
    font-size: 16px;
  }

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

  .actions button {
    flex: 0 1 auto;
    font-size: 13px;
    padding: 6px 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .panel {
    padding: 12px;
  }

  .agency-sheet {
    font-size: 10px;
  }

  .agency-sheet th,
  .agency-sheet td {
    min-width: 72px;
    height: 26px;
  }

  .agency-sheet .firm-col,
  .agency-sheet .firm-name {
    min-width: 110px;
    width: 110px;
  }

  .agency-sheet .firm-name button {
    font-size: 11px;
  }
}

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

  .login-aside {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 22px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .actions::-webkit-scrollbar {
    height: 4px;
  }

  .actions button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .flow-list {
    grid-template-columns: 1fr;
  }

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

  .special-days-panel {
    position: static;
    order: -1;
  }

  .task-list-toolbar {
    display: grid;
  }

  .task-controls {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0;
    margin: 0;
  }

  .modal form,
  .modal > div {
    border-radius: 0;
  }

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

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

  .client-detail-actions .danger-btn {
    width: 100%;
  }

  .agency-sheet {
    font-size: 11px;
  }

  .agency-sheet th,
  .agency-sheet td {
    width: 110px;
    min-width: 110px;
    height: 30px;
  }

  .agency-sheet .firm-col,
  .agency-sheet .firm-name {
    min-width: 130px;
    width: 130px;
  }

  .agency-sheet .firm-name button {
    font-size: 12px;
    padding: 4px 8px;
  }

  .sheet-cell,
  .sheet-cell-readonly,
  .note-cell button,
  .note-readonly {
    font-size: 12px !important;
    padding: 4px 6px;
  }
}

@media (max-width: 480px) {
  .topbar {
    margin-bottom: 8px;
  }

  .topbar h2 {
    font-size: 15px;
  }

  .topbar .eyebrow {
    font-size: 9px;
  }

  .actions {
    gap: 6px;
  }

  .actions button {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 36px;
  }

  .urgent-btn {
    font-size: 12px;
  }

  .workspace {
    padding: 8px 10px;
  }

  .sheet-board {
    gap: 6px;
  }

  .sheet-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .sheet-mini-counts {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .sheet-mini-counts span {
    font-size: 10px;
    min-height: 22px;
    padding: 0 6px;
  }

  .sheet-scroll {
    max-height: calc(100vh - 200px);
  }

  .active-workers {
    padding: 6px 8px;
  }

  .worker-chip {
    padding: 4px 8px;
    font-size: 11px;
  }

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

  .extra-card {
    padding: 10px;
  }

  .extra-card h3 {
    font-size: 14px;
  }

  .nav-toggle {
    width: 38px;
    height: 38px;
    font-size: 19px;
  }

  .modal form,
  .modal > div {
    padding: 14px;
  }

  .modal header h3,
  .modal #detailTitle,
  .modal #taskDialogTitle,
  .modal #workerDialogTitle {
    font-size: 16px;
  }

  .filters input,
  .filters select,
  .filters textarea,
  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    font-size: 16px;
  }

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

  .client-card {
    padding: 10px;
  }

  .agency-sheet {
    font-size: 11px;
  }

  .agency-sheet th,
  .agency-sheet td {
    width: 100px;
    min-width: 100px;
    height: 32px;
  }

  .agency-sheet .firm-col,
  .agency-sheet .firm-name {
    min-width: 120px;
    width: 120px;
  }
}
