:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --surface-warm: #fbf7ef;
  --ink: #1d2520;
  --muted: #68746d;
  --line: #dce4dd;
  --line-strong: #c8d2ca;
  --accent: #1f7a5b;
  --accent-strong: #166448;
  --accent-soft: #dff1e9;
  --danger: #bd3d31;
  --danger-soft: #fae5e1;
  --warning: #9f6b0d;
  --shadow: 0 18px 40px rgba(31, 44, 36, 0.08);
  font-family:
    Pretendard,
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px 22px;
}

.app-header > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.18;
}

h2 {
  font-size: 24px;
  line-height: 1.3;
}

h3 {
  font-size: 18px;
  line-height: 1.3;
}

.header-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(560px, 100%);
}

.header-summary div {
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.header-summary span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.header-summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.tabs {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
}

.tab-button:hover,
.tab-button:focus-visible {
  border-color: var(--line);
  color: var(--ink);
  outline: none;
}

.tab-button.active {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tab-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  font-size: 16px;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.section-heading > * {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.export-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.field.compact {
  min-width: 160px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

input[type="date"] {
  padding-right: 34px;
}

textarea {
  min-height: 42px;
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 91, 0.16);
}

.task-form {
  display: grid;
  grid-template-columns:
    minmax(150px, 1fr)
    minmax(110px, 0.75fr)
    minmax(220px, 1.6fr)
    minmax(170px, 1fr)
    minmax(140px, 0.95fr)
    minmax(156px, 0.9fr)
    auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quick-notes-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(31, 44, 36, 0.05);
}

.quick-notes-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.quick-note-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.quick-note-form .primary-button {
  min-width: 86px;
}

.quick-note-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-note-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.quick-note-body {
  min-height: 34px;
  padding: 7px 10px;
  border-color: transparent;
  background: transparent;
  line-height: 1.4;
  overflow: hidden;
  resize: none;
}

.quick-note-body:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.quick-note-body:focus {
  background: #fff;
}

.quick-note-empty {
  padding: 12px;
}

.task-form-actions {
  display: contents;
}

.primary-button,
.icon-text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.primary-button {
  padding: 0 15px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
  outline: none;
}

.icon-text-button {
  padding: 0 12px;
}

.icon-text-button.secondary,
.icon-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.icon-text-button.secondary:hover,
.icon-text-button.secondary:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 91, 0.12);
  outline: none;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  white-space: nowrap;
}

.table-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.task-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.done-table {
  min-width: 1040px;
}

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

.task-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-table tr:last-child td {
  border-bottom: 0;
}

.task-table .corporation-cell,
.task-table .category-cell,
.task-table .status-cell,
.task-table .date-cell,
.task-table .actions-cell {
  white-space: nowrap;
}

.table-input,
.table-select,
.table-date,
.progress-input {
  height: 38px;
  min-width: 130px;
  background: #fff;
}

.task-table .table-select {
  width: max-content;
}

.table-input.name-input {
  min-width: 210px;
}

.card-title-content {
  min-width: 0;
}

.card-toggle-button {
  display: none;
}

.progress-cell {
  min-width: 300px;
}

.progress-input {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

textarea.table-input,
textarea.progress-input {
  height: auto;
  min-height: 38px;
  padding: 8px 10px;
  overflow: hidden;
  resize: none;
  line-height: 1.4;
}

.progress-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: start;
  min-width: 220px;
}

.progress-editor.has-current {
  grid-template-columns: minmax(0, 1fr) 34px 34px;
}

.progress-editor.has-current.has-history {
  grid-template-columns: minmax(0, 1fr) 34px 34px 34px;
}

.progress-current,
.progress-history-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.progress-current {
  grid-column: 1;
}

.progress-editor > .progress-add {
  grid-column: 2;
}

.progress-editor.has-history > .progress-add {
  grid-column: 3;
}

.progress-remove {
  grid-column: 3;
}

.progress-editor.has-history > .progress-remove {
  grid-column: 4;
}

.progress-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: start;
}

.current-progress-item {
  grid-template-columns: minmax(0, 1fr);
}

.progress-empty {
  display: flex;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-history-toggle {
  display: inline-grid;
  grid-column: 2;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.progress-history-toggle::before {
  content: "▾";
  line-height: 1;
}

.progress-history-toggle.is-open::before {
  content: "▴";
}

.progress-history-toggle:hover,
.progress-history-toggle:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
}

.progress-history-list {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.progress-history-list[hidden] {
  display: none;
}

.progress-summary {
  max-width: 340px;
  color: var(--ink);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.corporation-cell .table-select {
  width: var(--control-fit-width, max-content);
  min-width: 0;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 114px;
}

.row-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.row-button:hover,
.row-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.row-button.danger:hover,
.row-button.danger:focus-visible {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.date-muted {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: none;
  padding: 28px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.empty-state.visible {
  display: block;
}

.wide {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.note-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.note-card header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-card input {
  font-weight: 900;
}

.note-card textarea {
  min-height: 260px;
  line-height: 1.55;
}

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

.management-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.item-form {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

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

.item-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-warm);
}

.item-list span,
.item-list .item-value {
  flex: 1;
  min-width: 0;
}

.item-list span {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.item-list .item-value {
  height: 36px;
  background: #fff;
  font-weight: 800;
}

.danger-text {
  color: var(--danger);
}

body.auth-locked {
  overflow: hidden;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(245, 247, 244, 0.94);
  backdrop-filter: blur(10px);
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-description {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.auth-actions .primary-button {
  width: 100%;
}

body.auth-locked .app-shell {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

.lock-button {
  align-self: center;
  flex: 0 0 auto;
}

.lock-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

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

  .tabs {
    position: static;
    display: flex;
    overflow-x: auto;
  }

  .tab-button {
    width: auto;
    min-width: 108px;
  }

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

  .task-form .primary-button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1540px);
    padding-top: 14px;
  }

  .app-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .app-header {
    flex-flow: row wrap;
    align-items: center;
    gap: 9px 10px;
    padding: 0 2px 12px;
  }

  .app-header > div:first-child {
    order: 1;
    flex: 1 1 auto;
  }

  .app-header .eyebrow {
    display: none;
  }

  .app-header h1 {
    font-size: 21px;
    line-height: 1.18;
  }

  .lock-button {
    order: 2;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .lock-button svg {
    width: 16px;
    height: 16px;
  }

  .header-summary {
    order: 3;
    flex: 0 0 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .header-summary div {
    min-height: 50px;
    padding: 8px 9px;
    box-shadow: 0 8px 18px rgba(31, 44, 36, 0.05);
  }

  .header-summary span {
    font-size: 19px;
    line-height: 1.05;
  }

  .header-summary small {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.15;
  }

  .toolbar,
  .export-actions {
    justify-content: stretch;
  }

  .toolbar > *,
  .export-actions > * {
    width: 100%;
  }

  .field.compact {
    min-width: 0;
  }

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

/* v1.02: glance-first task view */
:root {
  --urgent: #c43d2f;
  --urgent-soft: #fff1ee;
  --today: #b26a00;
  --today-soft: #fff6df;
  --soon: #2267b8;
  --soon-soft: #eef6ff;
  --idle: #6b7280;
  --idle-soft: #f3f4f6;
}

.app-header {
  align-items: center;
}

.header-summary div {
  border-radius: 12px;
}

.header-summary div:nth-child(2) {
  border-color: #eed39a;
  background: var(--today-soft);
}

.header-summary div:nth-child(2) span {
  color: var(--today);
}

.header-summary div:nth-child(3) {
  border-color: #efb9b2;
  background: var(--urgent-soft);
}

.header-summary div:nth-child(3) span {
  color: var(--urgent);
}

.header-summary div:nth-child(4) {
  border-color: #b9d7c9;
  background: var(--accent-soft);
}

.header-summary div:nth-child(4) span {
  color: var(--accent-strong);
}

.task-form {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(31, 44, 36, 0.05);
}

.table-shell {
  border-radius: 12px;
}

.task-table {
  min-width: 1120px;
}

.task-table th,
.task-table td {
  padding: 11px 10px;
}

.task-table th.main-column {
  width: 25%;
}

.task-table th.sortable-column {
  padding: 0;
}

.sort-header-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  padding: 11px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
}

.sort-header-button:hover,
.sort-header-button:focus-visible {
  color: var(--accent-strong);
  outline: none;
}

.sort-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sort-icon {
  display: inline-grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.sorted-column .sort-icon {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.task-table tbody tr {
  transition:
    background-color 0.12s ease,
    box-shadow 0.12s ease;
}

.task-table tbody tr:hover {
  background: #fbfdfc;
}

.task-row td:first-child {
  border-left: 5px solid transparent;
}

.task-row.due-overdue td:first-child {
  border-left-color: var(--urgent);
}

.task-row.due-today td:first-child {
  border-left-color: var(--today);
}

.task-row.due-soon td:first-child {
  border-left-color: var(--soon);
}

.task-row.due-overdue {
  background: linear-gradient(90deg, rgba(196, 61, 47, 0.08), transparent 32%);
}

.task-row.due-today {
  background: linear-gradient(90deg, rgba(178, 106, 0, 0.08), transparent 32%);
}

.table-input,
.table-select,
.table-date,
.progress-input {
  border-color: transparent;
  background: transparent;
}

.table-input:hover,
.table-select:hover,
.table-date:hover,
.progress-input:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.table-input:focus,
.table-select:focus,
.table-date:focus,
.progress-input:focus {
  background: #fff;
}

.name-cell {
  min-width: 260px;
}

.table-input.name-input,
.name-text {
  min-width: 250px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.progress-cell {
  min-width: 320px;
}

.progress-input {
  color: #344139;
}

.status-cell {
  width: 1%;
  min-width: 124px;
}

.status-select,
.status-pill {
  min-height: 32px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-select {
  width: var(--control-fit-width, max-content);
  min-width: 0;
  height: 34px;
  padding: 0 30px 0 12px;
  border-color: transparent;
}

.status-idle {
  background: var(--idle-soft);
  color: var(--idle);
}

.status-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-waiting {
  background: var(--today-soft);
  color: var(--today);
}

.status-done {
  background: #e8f0ff;
  color: #234da0;
}

.status-default {
  background: var(--surface-soft);
  color: var(--muted);
}

.due-date-cell {
  min-width: 242px;
  white-space: normal;
}

.table-date {
  display: block;
  width: 182px;
  min-width: 182px;
  font-weight: 800;
}

.due-date-content {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  width: max-content;
  max-width: none;
}

.due-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 0;
  margin-left: 0;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}

.due-overdue .due-badge,
.due-date-cell.due-overdue .due-badge {
  background: var(--urgent-soft);
  color: var(--urgent);
}

.due-today .due-badge,
.due-date-cell.due-today .due-badge {
  background: var(--today-soft);
  color: var(--today);
}

.due-soon .due-badge,
.due-date-cell.due-soon .due-badge {
  background: var(--soon-soft);
  color: var(--soon);
}

.due-normal .due-badge,
.due-date-cell.due-normal .due-badge,
.due-none .due-badge,
.due-date-cell.due-none .due-badge {
  background: var(--surface-soft);
  color: var(--muted);
}

.corporation-cell,
.category-cell,
.muted-meta {
  color: var(--muted);
  font-size: 13px;
}

.corporation-cell {
  width: 1%;
  min-width: 146px;
}

.action-group {
  opacity: 0.72;
}

.task-row:hover .action-group,
.action-group:focus-within {
  opacity: 1;
}

@media (max-width: 760px) {
  .header-summary div,
  .header-summary div:nth-child(2),
  .header-summary div:nth-child(3),
  .header-summary div:nth-child(4) {
    min-height: 50px;
  }
}

/* Responsive polish: keep wide controls contained and make mobile task rows readable. */
.task-table {
  min-width: 1120px;
}

.done-table {
  min-width: 1120px;
}

.task-table:not(.done-table) {
  min-width: 0;
  table-layout: fixed;
}

.task-table:not(.done-table) th:nth-child(1) {
  width: 14%;
}

.task-table:not(.done-table) th:nth-child(2) {
  width: 24%;
}

.task-table:not(.done-table) th:nth-child(3) {
  width: 124px;
}

.task-table:not(.done-table) th:nth-child(4) {
  width: 260px;
}

.task-table:not(.done-table) th:nth-child(5) {
  width: 12%;
}

.task-table:not(.done-table) th:nth-child(6) {
  width: 92px;
}

.task-table:not(.done-table) th:nth-child(7) {
  width: 118px;
}

.task-table:not(.done-table) .name-cell,
.task-table:not(.done-table) .progress-cell,
.task-table:not(.done-table) .status-cell,
.task-table:not(.done-table) .due-date-cell,
.task-table:not(.done-table) .corporation-cell,
.task-table:not(.done-table) .category-cell,
.task-table:not(.done-table) .actions-cell {
  min-width: 0;
}

.task-table:not(.done-table) .table-input,
.task-table:not(.done-table) .table-select,
.task-table:not(.done-table) .table-date,
.task-table:not(.done-table) .progress-input,
.task-table:not(.done-table) .table-input.name-input,
.task-table:not(.done-table) .status-select,
.task-table:not(.done-table) .corporation-cell .table-select,
.task-table:not(.done-table) .category-cell .table-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.task-table:not(.done-table) .due-date-content {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 226px;
  width: 100%;
  max-width: 100%;
}

.task-table:not(.done-table) .table-date {
  flex: 0 0 182px;
  width: 182px;
  min-width: 182px;
}

.task-table:not(.done-table) .due-badge {
  flex: 0 0 auto;
}

.task-table:not(.done-table) .action-group {
  min-width: 0;
  flex-wrap: nowrap;
  gap: 5px;
}

.task-table:not(.done-table) .row-button {
  width: 32px;
  height: 32px;
}

.corporation-cell .table-select {
  width: var(--control-fit-width, max-content);
  min-width: 0;
}

.category-cell .table-select {
  min-width: 160px;
}

.status-cell {
  width: 1%;
  min-width: 124px;
}

.status-select {
  width: var(--control-fit-width, max-content);
  min-width: 0;
}

.name-text {
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 1420px) and (min-width: 1181px) {
  .task-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-name-field {
    grid-column: span 2;
  }

  .task-form .primary-button {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    padding: 5px;
    overflow: hidden;
  }

  .tab-button {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 3px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
  }

  .tab-icon {
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    font-size: 13px;
  }

  .task-form .primary-button,
  .auth-actions .primary-button {
    min-height: 44px;
  }

  .task-form.mobile-collapsed {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .task-form.mobile-collapsed .field {
    display: none;
  }

  .task-form.mobile-expanded .task-form-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(88px, 0.42fr) minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }

  .task-form.mobile-expanded .task-close-button,
  .task-form.mobile-expanded .primary-button,
  .task-form.mobile-collapsed .primary-button {
    width: 100%;
  }

  .table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .task-table,
  .done-table {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
  }

  .task-table thead {
    display: none;
  }

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

  .task-table tbody tr {
    display: grid;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .task-table tbody tr:hover {
    background: var(--surface);
  }

  .task-row td:first-child,
  .task-row.due-overdue td:first-child,
  .task-row.due-today td:first-child,
  .task-row.due-soon td:first-child {
    border-left: 0;
  }

  .task-row.due-overdue {
    border-left: 5px solid var(--urgent);
  }

  .task-row.due-today {
    border-left: 5px solid var(--today);
  }

  .task-row.due-soon {
    border-left: 5px solid var(--soon);
  }

  .task-table th,
  .task-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
  }

  .task-table td::before {
    grid-column: 1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  .task-table td > * {
    grid-column: 2;
    min-width: 0;
  }

  .card-title-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    min-width: 0;
  }

  .card-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
  }

  .card-toggle-button:hover,
  .card-toggle-button:focus-visible {
    border-color: var(--accent);
    color: var(--accent-strong);
    outline: none;
  }

  .task-row.card-collapsed {
    gap: 8px;
  }

  .task-table:not(.done-table) .task-row.card-collapsed > td:not(.name-cell):not(.due-date-cell),
  .done-table .task-row.card-collapsed > td:not(.name-cell):not(:nth-child(4)) {
    display: none;
  }

  .due-date-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    max-width: 100%;
  }

  .task-table:not(.done-table) tbody td:nth-child(1)::before {
    content: "업무명";
  }

  .task-table:not(.done-table) tbody td:nth-child(2)::before {
    content: "진행상황";
  }

  .task-table:not(.done-table) tbody td:nth-child(3)::before {
    content: "진행현황";
  }

  .task-table:not(.done-table) tbody td:nth-child(4)::before {
    content: "기한";
  }

  .task-table:not(.done-table) tbody td:nth-child(5)::before {
    content: "법인";
  }

  .task-table:not(.done-table) tbody td:nth-child(6)::before {
    content: "구분";
  }

  .task-table:not(.done-table) tbody td:nth-child(7)::before {
    content: "관리";
  }

  .done-table tbody td:nth-child(1)::before {
    content: "업무명";
  }

  .done-table tbody td:nth-child(2)::before {
    content: "진행상황";
  }

  .done-table tbody td:nth-child(3)::before {
    content: "진행현황";
  }

  .done-table tbody td:nth-child(4)::before {
    content: "기한";
  }

  .done-table tbody td:nth-child(5)::before {
    content: "완료일";
  }

  .done-table tbody td:nth-child(6)::before {
    content: "법인";
  }

  .done-table tbody td:nth-child(7)::before {
    content: "구분";
  }

  .done-table tbody td:nth-child(8)::before {
    content: "관리";
  }

  .table-input,
  .table-select,
  .table-date,
  .progress-input,
  .table-input.name-input,
  .task-table .table-select,
  .status-select,
  .corporation-cell .table-select,
  .category-cell .table-select {
    width: 100%;
    min-width: 0;
  }

  .name-cell,
  .progress-cell,
  .status-cell,
  .due-date-cell {
    min-width: 0;
  }

  .progress-editor {
    width: 100%;
    min-width: 0;
  }

  .progress-summary {
    max-width: none;
  }

  .action-group {
    justify-content: flex-end;
    min-width: 0;
  }
}

@media (max-width: 360px) {
  .tabs {
    gap: 4px;
    padding: 4px;
  }

  .tab-button {
    gap: 3px;
    min-height: 42px;
    font-size: 11px;
  }

  .tab-icon {
    flex-basis: 14px;
    width: 14px;
    height: 14px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .header-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-note-form {
    grid-template-columns: 1fr;
  }

  .task-table th,
  .task-table td {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .task-table td::before,
  .task-table td > * {
    grid-column: 1;
  }

  .action-group {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .task-table .status-cell,
  .task-table .corporation-cell {
    width: 100%;
    min-width: 0;
  }

  .task-table .status-select,
  .task-table .corporation-cell .table-select {
    justify-self: stretch;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .task-table:not(.done-table) .task-row.card-collapsed {
    gap: 7px;
    padding: 10px 12px;
    border-radius: 10px;
  }

  .task-table:not(.done-table) .task-row.card-collapsed > .name-cell,
  .task-table:not(.done-table) .task-row.card-collapsed > .due-date-cell {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 7px;
    align-items: center;
    padding: 0;
  }

  .task-table:not(.done-table) .task-row.card-collapsed > .name-cell::before,
  .task-table:not(.done-table) .task-row.card-collapsed > .due-date-cell::before {
    grid-column: 1;
    align-self: center;
    font-size: 12px;
    line-height: 1.2;
  }

  .task-table:not(.done-table) .task-row.card-collapsed > .name-cell > *,
  .task-table:not(.done-table) .task-row.card-collapsed > .due-date-cell > * {
    grid-column: 2;
  }

  .task-table:not(.done-table) .task-row.card-collapsed .card-title-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
  }

  .task-table:not(.done-table) .task-row.card-collapsed .table-input.name-input {
    height: 30px !important;
    min-height: 30px;
    padding: 4px 0;
    overflow: hidden;
    border-color: transparent;
    background: transparent;
    font-size: 15px;
    line-height: 1.25;
    resize: none;
  }

  .task-table:not(.done-table) .task-row.card-collapsed .card-toggle-button {
    min-height: 30px;
    padding: 0 9px;
  }

  .task-table:not(.done-table) .task-row.card-collapsed .due-date-content {
    display: grid;
    grid-template-columns: minmax(142px, 1fr) auto;
    gap: 7px;
    align-items: center;
    width: 100%;
  }

  .task-table:not(.done-table) .task-row.card-collapsed .table-date {
    width: 100%;
    min-width: 142px;
    height: 30px;
    padding: 4px 30px 4px 0;
    border-color: transparent;
    background: transparent;
    font-size: 15px;
    line-height: 1.2;
  }

  .task-table:not(.done-table) .task-row.card-collapsed .due-badge {
    min-height: 22px;
    padding: 0 7px;
    font-size: 11px;
  }
}
