:root {
  color-scheme: dark;
  --background: #081018;
  --surface: #101c27;
  --surface-raised: #162634;
  --text: #f4f8fa;
  --muted: #8fa4b3;
  --accent: #27c6d9;
  --accent-strong: #5ce1e6;
  --success: #45d483;
  --warning: #efba68;
  --danger: #bd5b62;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--background);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(
      circle at 85% -10%,
      rgba(39, 198, 217, 0.11),
      transparent 30rem
    ),
    var(--background);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    calc(92px + env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.bottom-navigation {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 7px 12px max(7px, env(safe-area-inset-bottom));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: rgba(12, 23, 34, 0.97);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.28);
}

.bottom-navigation-item {
  display: grid;
  min-width: 0;
  min-height: 50px;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 4px 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  touch-action: manipulation;
}

.bottom-navigation-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bottom-navigation-item[data-active="true"] {
  background: rgba(39, 198, 217, 0.1);
  color: var(--accent);
}

.bottom-navigation-placeholder {
  cursor: default;
  opacity: 0.32;
}

.bottom-navigation-placeholder svg {
  fill: currentColor;
  stroke: none;
}

.app-header,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-header > *,
.section-heading > *,
.module-view-header > div {
  min-width: 0;
}

.app-header {
  padding: 8px 0 30px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
  font-size: clamp(42px, 12vw, 62px);
  font-weight: 780;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  fill: rgba(39, 198, 217, 0.08);
  stroke: var(--accent);
}

.brand-shell {
  stroke-width: 2;
}

.brand-core,
.brand-wave {
  fill: none;
  stroke: var(--accent-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-core {
  stroke-width: 4;
}

.brand-wave {
  stroke-width: 2;
}

.environment-badge,
.module-state {
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.environment-badge {
  flex: 0 0 auto;
  max-width: 42%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.intro {
  min-width: 0;
  padding: 18px 0 30px;
}

.view[hidden] {
  display: none;
}

.view,
.activity,
.activity-list,
.activity-card,
.task-list,
.task-card,
.task-capture-panel,
.task-capture-panel form,
.status-panel,
.setup-panel,
.setup-panel form {
  min-width: 0;
  max-width: 100%;
}

.task-capture-panel[hidden] {
  display: none;
}

#taskListView[hidden],
#dailyJobsView[hidden],
#dailyJobsExecutionView[hidden],
#tasksHeader[hidden],
.task-header-actions[hidden] {
  display: none;
}

.task-capture-panel {
  margin-bottom: 16px;
  padding: 17px;
  border: 1px solid rgba(39, 198, 217, 0.28);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-capture-panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.task-capture-panel form {
  display: grid;
  gap: 9px;
}

.task-capture-panel label {
  font-size: 12px;
  font-weight: 700;
}

.task-capture-panel label span {
  color: var(--muted);
  font-weight: 500;
}

.action-tag-label {
  font-size: 12px;
  font-weight: 700;
}

.action-tag-label span {
  color: var(--muted);
  font-weight: 500;
}

.action-tag-options,
.action-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.action-tag-option,
.action-tag-add,
.action-tag-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid rgba(39, 198, 217, 0.24);
  border-radius: 999px;
  background: rgba(39, 198, 217, 0.07);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.1;
}

.action-tag-option,
.action-tag-add {
  cursor: pointer;
  touch-action: manipulation;
}

.action-tag-option[aria-pressed="true"] {
  border-color: rgba(39, 198, 217, 0.72);
  background: rgba(39, 198, 217, 0.15);
  color: var(--accent);
}

.action-tag-add {
  width: 34px;
  padding: 0;
  color: var(--accent);
  font-size: 18px;
}

.action-tag-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-top: 9px;
}

.task-capture-panel .action-tag-add-form input {
  min-height: 40px;
}

.action-tag-add-form button {
  min-width: 64px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--background);
  cursor: pointer;
  font-weight: 800;
}

.action-tag-error {
  grid-column: 1 / -1;
  min-height: 16px;
  margin: 0;
  color: var(--warning);
  font-size: 11px;
}

.action-tags {
  margin-top: 9px;
}

.action-tag-chip {
  min-height: 0;
  padding: 4px 8px;
  color: var(--accent);
}

.task-capture-panel input,
.task-capture-panel textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.task-capture-panel input {
  min-height: 48px;
  padding: 0 14px;
}

.task-capture-panel textarea {
  min-height: 70px;
  padding: 12px 14px;
  line-height: 1.4;
  resize: none;
}

.task-capture-panel input:focus,
.task-capture-panel textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 198, 217, 0.12);
}

.task-capture-error {
  min-height: 18px;
  margin: 0;
  color: var(--warning);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.add-task-button,
.daily-jobs-button,
.work-log-add-button,
.save-task-button,
.cancel-task-button,
.next-button {
  min-height: 48px;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  touch-action: manipulation;
}

.work-log-add-button {
  width: 100%;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

.work-log-capture-panel .save-task-button {
  width: 100%;
}

.task-header-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.task-header-actions > button {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(39, 198, 217, 0.28);
  border-radius: 14px;
  background: var(--surface-raised);
  color: var(--accent);
  font-size: 14px;
}

.save-task-button {
  border: 0;
  background: var(--accent);
  color: var(--background);
}

.cancel-task-button {
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

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

.swipe-row {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.swipe-surface {
  position: relative;
  z-index: 2;
  transition: transform 180ms ease-out;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  will-change: transform;
}

.swipe-surface.is-dragging {
  transition: none;
}

.swipe-task-card,
.swipe-daily-job-card {
  width: 100%;
}

.swipe-actions {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  display: flex;
}

.swipe-actions-leading {
  left: 0;
}

.swipe-actions-trailing {
  right: 0;
}

.swipe-action {
  width: 82px;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  touch-action: manipulation;
}

.swipe-action-edit {
  background: rgba(39, 198, 217, 0.72);
  color: var(--background);
}

.swipe-action-completed {
  background: var(--accent);
  color: var(--background);
}

.swipe-action-delete {
  background: var(--danger);
}

.swipe-action-move {
  background: rgba(39, 198, 217, 0.16);
  color: var(--accent);
}

.task-undo-toast[hidden] {
  display: none;
}

.task-undo-toast {
  position: fixed;
  z-index: 30;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  display: flex;
  width: min(420px, calc(100% - 36px));
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-raised);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-size: 13px;
}

.task-undo-toast button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(39, 198, 217, 0.1);
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.operation-toast[hidden] {
  display: none;
}

.operation-toast {
  position: fixed;
  z-index: 30;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  display: grid;
  width: min(420px, calc(100% - 36px));
  min-height: 58px;
  gap: 2px;
  margin: 0 auto;
  padding: 10px 16px;
  border: 1px solid rgba(39, 198, 217, 0.36);
  border-radius: 15px;
  background: var(--surface-raised);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  color: var(--text);
}

.operation-toast strong {
  color: var(--accent);
  font-size: 13px;
}

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

.operation-toast[data-state="error"] {
  border-color: rgba(210, 83, 83, 0.42);
}

.operation-toast[data-state="error"] strong {
  color: var(--danger);
}

.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: rgba(39, 198, 217, 0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.task-card h2 {
  min-width: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

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

.task-note {
  position: relative;
  margin: 8px 0 0;
  padding-left: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.task-note::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
  opacity: 0.72;
}

.daily-jobs-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.daily-jobs-heading h2 {
  margin: 0;
  font-size: 22px;
}

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

.daily-job-item {
  display: block;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  transition: border-color 140ms ease, background-color 140ms ease,
    box-shadow 140ms ease;
}

.daily-job-option {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 17px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  touch-action: manipulation;
}

.daily-job-item[data-selected="true"] {
  border-color: var(--accent);
  background: rgba(39, 198, 217, 0.1);
  box-shadow: inset 0 0 0 1px rgba(39, 198, 217, 0.2);
}

.daily-job-item[data-selected="true"] .task-number {
  background: var(--accent);
  color: var(--background);
}

.daily-job-selection-indicator {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--background);
  font-size: 16px;
  font-weight: 900;
}

.daily-job-item[data-selected="true"] .daily-job-selection-indicator {
  border-color: var(--accent);
  background: var(--accent);
}

.daily-job-item[data-selected="true"] .daily-job-selection-indicator::before {
  content: "✓";
}

.daily-job-crew[hidden] {
  display: none;
}

.daily-job-crew {
  padding: 0 17px 15px 65px;
}

.assigned-crew-tags,
.crew-selector-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.crew-tag,
.crew-assign-button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid rgba(39, 198, 217, 0.28);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  touch-action: manipulation;
}

.assigned-crew-tag {
  background: rgba(39, 198, 217, 0.1);
}

.crew-assign-button {
  margin-top: 8px;
  border-color: transparent;
  background: transparent;
}

.crew-selector {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.crew-selector-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.crew-selector-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--background);
}

.next-button {
  width: 100%;
  margin-top: 18px;
  border: 0;
  background: var(--accent);
  color: var(--background);
}

.next-button:disabled {
  opacity: 0.55;
}

.daily-jobs-execution-list {
  display: grid;
  gap: 26px;
}

.daily-jobs-crew-group h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 0.01em;
}

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

.crew-jobs-empty {
  margin: 0;
  padding: 12px 2px;
  color: var(--muted);
  font-size: 13px;
}

.execution-job-content {
  min-width: 0;
}

.execution-crew-tags {
  margin-top: 10px;
}

.execution-crew-tag {
  display: inline-flex;
  min-height: 0;
  cursor: default;
}

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

.setup-panel {
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid rgba(39, 198, 217, 0.28);
  border-radius: var(--radius);
  background: var(--surface);
}

.setup-heading h2 {
  margin: 0;
  font-size: clamp(24px, 7vw, 32px);
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.setup-heading > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.setup-panel form {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.setup-panel label {
  margin-top: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.setup-panel input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.setup-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 198, 217, 0.12);
}

.setup-error {
  min-height: 18px;
  margin: 2px 0 0;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.connect-button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--background);
  cursor: pointer;
  font-weight: 800;
  touch-action: manipulation;
}

.connect-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.module-view-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.back-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
}

.module-view-header h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 42px);
  letter-spacing: -0.045em;
}

.module-view-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 9vw, 58px);
  letter-spacing: -0.055em;
  line-height: 1;
}

.intro > p:last-child {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

.module-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 148px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  touch-action: manipulation;
}

.module-card:not(:disabled) {
  cursor: pointer;
}

.module-card:disabled {
  opacity: 0.52;
}

.module-state {
  position: absolute;
  top: 17px;
  right: 17px;
  max-width: calc(100% - 34px);
  overflow-wrap: anywhere;
  text-align: right;
}

.module-card strong {
  font-size: 20px;
}

.module-card > span:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.activity {
  margin-top: 42px;
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(24px, 6vw, 32px);
  letter-spacing: -0.04em;
}

.section-heading > span {
  color: var(--muted);
  font-size: 12px;
}

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

.activity-card,
.status-panel {
  border: 1px solid var(--border);
  background: var(--surface);
}

.activity-card {
  padding: 17px;
  border-radius: var(--radius);
}

.activity-id {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.activity-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.activity-context {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.activity-running-hours {
  margin: 7px 0 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.activity-meta > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-state,
.loading-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-panel {
  display: grid;
  gap: 4px;
  margin-top: 28px;
  padding: 14px 16px;
  border-radius: 16px;
}

.status-panel strong {
  color: var(--accent);
  font-size: 13px;
}

.status-panel span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-panel[data-state="connected"] strong {
  color: var(--success);
}

.status-panel[data-state="error"] strong {
  color: var(--warning);
}

@media (min-width: 700px) {
  .app-shell {
    padding-right: 28px;
    padding-left: 28px;
  }

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

@media (max-width: 420px) {
  .app-header {
    gap: 12px;
    padding-bottom: 22px;
  }

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

  .environment-badge {
    max-width: 92px;
    text-align: center;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .module-view-header {
    flex-wrap: wrap;
  }

}

@media (max-width: 340px) {
  .module-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
