.search-box { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; background: white; border: 1px solid #c8dfe9; border-radius: 17px; padding: 0 14px; height: 54px; margin-top: -26px; box-shadow: 0 6px 20px #27678a0d; color: var(--accent); }
.search-box input { width: 100%; min-width: 0; padding: 10px 0; border: 0; background: transparent; outline-offset: 1px; font-size: 14px; }
.clear-search { background: transparent; margin-right: -9px; width: 40px; height: 42px; display: grid; place-items: center; border-radius: 10px; }
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 17px 0 23px; padding: 5px; background: #eaf2f7; border-radius: 15px; border: 1px solid #d2e3ec; }
.filter { min-width: 0; padding: 10px 2px; min-height: 44px; background: transparent; border-radius: 11px; font-size: 13px; font-weight: 600; color: #4d697b; white-space: nowrap; transition: background .15s, color .15s; border: 1px solid transparent; }
.filter[aria-pressed="true"] { background: #ffffff; color: var(--accent); box-shadow: 0 2px 6px #25688212; border-color: #b3d7e5; font-weight: 700; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 13px; }
#list-title { font-weight: 650; }
#work-view .group-switcher select, #work-view .group-manage-button { font-weight: 600; }
.result-count { color: var(--muted); font-size: 12px; }
.task-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.task-card { width: 100%; min-width: 0; text-align: left; padding: 13px 14px; background: white; border-radius: 15px; border: 1px solid #afdce8; box-shadow: 0 4px 16px #236d9205; transition: transform .16s, box-shadow .16s, border-color .16s; }
.card-top .badge { flex-shrink: 0; }
.category { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0; display: flex; align-items: center; gap: 6px; }
.category-dot { width: 6px; height: 6px; border-radius: 50%; background: #57c7da; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 3px 8px; border-radius: 7px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge .icon { width: 12px; height: 12px; }
.badge-urgent { background: #fff0e7; color: #9e4126; }
.badge-active { background: #e8f4fc; color: #146a91; }
.badge-done { background: #e6f7ed; color: #176e50; }
.task-title { font-size: 16px; font-weight: 650; line-height: 1.4; letter-spacing: -.2px; margin: 0; min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer .category { font-size: 11px; flex: 0 0 auto; max-width: 42%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.assignee { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: #496a7b; min-width: 0; }
.card-bottom .assignee { max-width: 54%; }
.assignee-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-group { display: inline-flex; align-items: center; flex-shrink: 0; padding-left: 5px; }
.avatar-group .avatar { margin-left: -5px; border: 2px solid white; }
.detail-assignees { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; max-height: 82px; overflow-y: auto; }
.detail-assignees .assignee { background: #eef8fb; border-radius: 10px; padding: 3px 8px 3px 4px; }
.avatar-linh { background: #e6f7f1; color: #278c6f; }
.avatar-minh { background: #eeeafd; color: #7c62ac; }
.avatar-an { background: #fff0e4; color: #a97941; }
.due { display: inline-flex; align-items: center; gap: 4px; }
.due .icon { width: 13px; height: 13px; }
.due.overdue { color: #ad4c37; }
.progress-track { height: 4px; flex: 1; background: #e0ecf2; border-radius: 99px; overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--gradient); border-radius: inherit; transition: width .2s; }
.progress-label { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 29px; text-align: right; }
.add-task { position: fixed; right: max(20px, calc((100vw - 540px) / 2 + 20px)); bottom: calc(94px + env(safe-area-inset-bottom, 0px)); z-index: 5; width: 56px; height: 56px; padding: 0; display: grid; place-items: center; color: white; border-radius: 50%; background: var(--gradient); box-shadow: 0 8px 24px #26abcf40, 0 2px 6px #193f521a; transition: transform .15s; }
.add-task .icon { width: 28px; height: 28px; stroke-width: 2.2; }
.add-task:active { transform: scale(.94); }
.local-note { display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--muted); font-size: 12px; margin: 18px 0 0; text-align: center; }
.local-note .icon { width: 13px; height: 13px; }
.workspace-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: white; flex-shrink: 0; }
.workspace-toolbar p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.workspace-modes { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #edf4f8; flex-shrink: 0; border: 1px solid #d2e3ec; }
.workspace-modes button { min-height: 44px; padding: 8px 12px; border-radius: 9px; background: transparent; color: #4d697b; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.workspace-modes button[aria-pressed="true"] { background: white; color: var(--accent); box-shadow: 0 2px 6px #25688212; border-color: #b3d7e5; font-weight: 700; }
.workspace-board { flex: 1; min-height: 0; overflow-y: auto; padding: 22px; }
.board-intro { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.board-intro h3 { margin: 0 0 4px; font-size: 19px; font-weight: 650; letter-spacing: -.4px; }
.board-intro p { margin: 0; font-size: 12px; color: var(--muted); }
.board-total { padding: 6px 10px; border: 1px solid #dceef3; border-radius: 10px; background: white; color: var(--muted); font-size: 12px; white-space: nowrap; }
.board-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board-column { min-width: 0; padding: 12px; border: 1px solid #d6e5ed; border-radius: 17px; background: #edf4f8; }
.board-column-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 13px; font-size: 13px; font-weight: 650; }
.board-column-title { display: flex; align-items: center; gap: 7px; }
.board-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #39afd0; }
.board-column[data-status="urgent"] .board-status-dot { background: #e58c5d; }
.board-column[data-status="done"] .board-status-dot { background: #49b58f; }
.board-tasks { display: grid; gap: 10px; }
.board-card { min-width: 0; width: 100%; display: grid; gap: 12px; padding: 14px; text-align: left; border-radius: 12px; border: 1px solid #7dd3e0; background: white; box-shadow: 0 3px 8px #236d9206; }
.board-card:hover { border-color: #7dd3e0; box-shadow: var(--shadow); }
.board-card-title { font-size: 15px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.board-card .category { font-size: 11px; }
.board-card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; }
.board-card .assignee { max-width: 100%; }
.board-card .due { font-size: 11px; color: var(--muted); }
.board-card .due.overdue { color: #ad4c37; }
.board-empty { margin: 0; padding: 20px 8px; border: 1px dashed #cfe3ec; border-radius: 11px; text-align: center; font-size: 12px; color: var(--muted); }
.desktop-detail-slot { flex: 1; min-height: 0; }
#detail-dialog { height: min(850px, calc(100vh - 48px)); height: min(850px, calc(100dvh - 48px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
#detail-dialog #back-button { background: transparent; box-shadow: none; -webkit-tap-highlight-color: transparent; font-weight: 600; }
.detail-layout { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.detail-summary-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
#desktop-edit-task-button { display: none; font-size: 12px; min-height: 34px; }
.edit-task-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 8px 11px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.edit-task-button .icon { width: 15px; height: 15px; }
.task-summary { padding: 18px 22px 17px; background: white; flex-shrink: 0; max-height: 45vh; max-height: 45dvh; overflow-y: auto; }
.detail-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#detail-title { font-size: 21px; font-weight: 650; line-height: 1.35; letter-spacing: -.5px; margin: 10px 0 7px; overflow-wrap: anywhere; }
.detail-description { color: var(--muted); font-size: 13px; margin: 0 0 13px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 64px; overflow-y: auto; }
.detail-meta { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.detail-meta .assignee { font-size: 12px; }
.detail-meta .avatar { width: 25px; height: 25px; }
.detail-meta .due .icon { width: 14px; height: 14px; }
.mobile-detail-actions { display: contents; }
.detail-progress { margin-top: 10px; display: grid; grid-template-columns: minmax(0, auto) minmax(32px, 1fr) auto; align-items: center; gap: 8px; }
.progress-caption { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.progress-caption strong { color: var(--accent); font-size: 12px; }
.detail-progress .progress-caption { display: contents; }
.detail-progress .progress-caption > span { grid-column: 1; grid-row: 1; min-width: 0; font-size: 11px; line-height: 1.4; }
.detail-progress .progress-caption > strong { grid-column: 3; grid-row: 1; font-size: 11px; }
.detail-progress .progress-track { grid-column: 2; grid-row: 1; height: 4px; }
.complete-button { display: inline-flex; align-items: center; gap: 5px; background: #e7f7ef; color: #176f52; padding: 7px 9px; min-height: 36px; border-radius: 9px; font-size: 11px; font-weight: 650; border: 1px solid #b8dfcc; }
.complete-button .icon { width: 13px; height: 13px; }
.detail-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px 8px; background: var(--gradient); border-bottom: 1px solid #b5e3ed; flex-shrink: 0; gap: 4px; border-top: 1px solid #b5e3ed; border-radius: 14px; }
.detail-tabs.finance-restricted { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-tab { padding: 9px 2px; min-height: 44px; background: #ffffff18; color: white; display: flex; gap: 4px; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; white-space: nowrap; border: 1px solid #ffffff42; border-radius: 10px; }
.detail-tab .icon { width: 16px; height: 16px; }
.detail-tab .tab-count { font-size: 10px; font-weight: 650; padding: 1px 4px; background: #ffffff6b; color: inherit; }
.detail-tab[aria-selected="true"] { color: var(--accent); background: #ffffffeb; border-color: #ffffff; font-weight: 700; box-shadow: 0 2px 8px #176e9620, inset 0 1px 0 #ffffff; }
.detail-tab[aria-selected="true"] .tab-count { background: #d5f3f7; color: #075b75; }

@media (hover: hover) {
  .task-card:hover { transform: translateY(-2px); border-color: #afdce8; box-shadow: var(--shadow); }
}

@media (max-width: 600px) {
  .add-task { right: max(20px, env(safe-area-inset-right, 0px)); background: var(--gradient); }
  #detail-dialog { width: 100%; max-width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; margin: 0; }
  #detail-dialog .dialog-bar { padding-top: max(13px, env(safe-area-inset-top)); }
}

@media (max-width: 360px) {
  .filter { font-size: 13px; min-height: 44px; color: #4d697b; border: 1px solid transparent; }
  .task-card { padding: 13px 14px; border: 1px solid #afdce8; }
  .task-title { font-size: 16px; letter-spacing: -.2px; }
  .task-summary { padding: 14px 17px; }
  #detail-title { font-size: 19px; }
  .detail-tab { font-size: 12px; gap: 4px; padding: 9px 2px; min-height: 44px; border-radius: 10px; }
  .detail-tab .icon { display: none; width: 16px; height: 16px; }
}

@media (max-height: 650px) {
  .task-summary { padding-top: 12px; padding-bottom: 12px; }
  .detail-description { max-height: 36px; margin-bottom: 8px; font-size: 13px; }
  .detail-progress { margin-top: 10px; }
  #detail-title { margin-top: 7px; }
}

@media (min-width: 960px) {
  .work-layout { --task-sidebar-width: clamp(330px, 30vw, 410px); display: grid; grid-template-columns: var(--task-sidebar-width) minmax(0, 1fr); flex: 1; min-height: 0; position: relative; }
  .search-box { margin-top: 0; height: 48px; border-radius: 13px; border: 1px solid #c8dfe9; color: var(--accent); }
  .search-box input { font-size: 14px; }
  .filters { margin: 14px 0 18px; background: #eaf2f7; border: 1px solid #d2e3ec; }
  .filter { font-size: 13px; min-height: 44px; color: #4d697b; border: 1px solid transparent; }
  .task-card.is-selected { border-color: #4fbed4; background: #ecfaff; box-shadow: inset 3px 0 0 #30b7d4; }
  .add-task { position: absolute; right: auto; left: calc(var(--task-sidebar-width) - 76px); bottom: 20px; background: var(--gradient); }
  #detail-dialog { position: static; inset: auto; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; box-shadow: none; opacity: 1; transform: none; transition: none; }
  .workspace-toolbar { padding: 4px 16px; }
  .workspace-modes { padding: 3px; }
  .workspace-modes button { min-height: 44px; padding: 6px 11px; font-size: 13px; color: #4d697b; border: 1px solid transparent; }
  #detail-dialog .dialog-bar { display: none; }
  #detail-dialog .task-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 8px 16px; max-height: min(180px, 32vh); max-height: min(180px, 32dvh); }
  #detail-dialog .detail-topline { display: contents; }
  #detail-dialog #detail-badge { grid-column: 1; grid-row: 1; }
  #detail-dialog #detail-title { grid-column: 2; grid-row: 1; margin: 0; font-size: 18px; }
  #detail-dialog .detail-summary-actions { grid-column: 3; grid-row: 1; }
  #desktop-edit-task-button { display: inline-flex; min-height: 44px; padding: 5px 9px; font-size: 12px; }
  #detail-dialog .complete-button { min-height: 44px; padding: 5px 8px; font-size: 11px; }
  #detail-dialog .detail-description { grid-column: 1 / -1; margin: 0; max-height: 38px; font-size: 12px; line-height: 1.5; }
  #detail-dialog .detail-meta { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; font-size: 12px; }
  #detail-dialog .detail-meta .team-button { min-height: 44px; margin-left: 0; padding: 6px 9px; }
  #detail-dialog .detail-assignees { width: 100%; max-width: none; max-height: 32px; }
  #detail-dialog .detail-assignees .assignee { font-size: 11px; }
  #detail-dialog .detail-progress { grid-column: 1 / -1; margin-top: 0; }
  #detail-dialog .progress-caption { margin-bottom: 4px; font-size: 11px; }
  #detail-dialog .detail-progress .progress-track { height: 4px; }
  #detail-dialog .detail-tab { min-height: 44px; padding: 9px 2px; font-size: 12px; }
}

@media (min-width: 960px) and (max-width: 1199px) {
  .workspace-board { padding: 18px; }
  .board-columns { grid-template-columns: 1fr; }
  .board-tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) and (max-height: 760px) {
  .workspace-toolbar { flex-direction: row; align-items: center; padding: 4px 16px; }
  .workspace-toolbar p { display: none; }
  #detail-dialog .task-summary { max-height: 160px; padding: 6px 16px; }
  #detail-dialog .detail-tab { min-height: 44px; padding-top: 10px; padding-bottom: 10px; font-size: 12px; padding: 9px 2px; }
}

@media (max-width: 959px) {
  #detail-dialog .dialog-bar { padding: max(4px, env(safe-area-inset-top, 0px)) 12px 4px; }
  #detail-dialog .dialog-bar-actions { gap: 7px; }
  #detail-dialog .dialog-brand { display: none; }
  #detail-dialog .back-button, #detail-dialog .edit-task-button { min-height: 44px; }
  #detail-dialog .complete-button { min-height: 44px; padding: 6px 8px; font-size: 11px; }
  #detail-dialog .task-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 8px; padding: 8px 12px; max-height: 30vh; max-height: 30dvh; }
  #detail-dialog .detail-topline { display: contents; }
  #detail-dialog #detail-badge { grid-column: 1; grid-row: 1; }
  #detail-dialog #detail-title { grid-column: 2; grid-row: 1; margin: 0; font-size: 18px; line-height: 1.35; }
  #detail-dialog .detail-summary-actions { display: none; }
  #detail-dialog .detail-description { grid-column: 1 / -1; margin: 0; max-height: 36px; font-size: 12px; line-height: 1.5; }
  #detail-dialog .detail-meta { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 6px; font-size: 12px; }
  #detail-dialog .detail-assignees { width: 100%; max-width: none; max-height: 32px; }
  #detail-dialog .detail-assignees .assignee { font-size: 11px; gap: 4px; padding-right: 5px; }
  #detail-dialog .detail-meta .due { gap: 3px; white-space: nowrap; font-size: 11px; }
  #detail-dialog .detail-meta .team-button { margin-left: 0; min-height: 44px; }
  #detail-dialog .detail-progress { grid-column: 1 / -1; margin-top: 0; }
  #detail-dialog .progress-caption { margin-bottom: 4px; font-size: 11px; }
  #detail-dialog .detail-progress .progress-track { height: 4px; }
  #detail-dialog .detail-tab { min-height: 44px; padding-top: 10px; padding-bottom: 10px; font-size: 12px; padding: 9px 2px; }
}
