/* ============================================================================
 * Taskomania — interface refinements
 *
 * Loaded LAST, after experience.css, so everything here wins on equal
 * specificity without needing !important.
 *
 * Note for anyone editing styles in this project: `styles.css` and
 * `layout-fixes.css` exist in this folder but are NOT referenced by
 * index.html — they belong to an earlier design and the browser never loads
 * them. experience.css and this file are the live stylesheets.
 * ========================================================================= */

:root {
  --r-shadow-sm: 0 1px 2px #1e254008, 0 2px 6px #1e25400a;
  --r-shadow-md: 0 2px 4px #1e25400a, 0 8px 22px #1e254012;
  --r-shadow-lg: 0 10px 34px #1e254016, 0 2px 8px #1e25400d;
  --r-purple-soft: #f2effe;
  --r-amber: #b7791f;
  --r-red: #d14343;
}

/* ---------------------------------------------------------------------------
 * 1. Dialog sizing
 *
 * .dialog is width:min(680px,100%). The execution board puts three columns
 * inside that, leaving each about 200px — which is why the To do column
 * scrolled and the cards felt cramped. :has() scopes the extra width to
 * dialogs that actually contain a board, so single-field dialogs (Change Due
 * Date, Reassign) stay small instead of becoming a wall of whitespace.
 * ------------------------------------------------------------------------ */
/* experience.css sets `.dialog { width: min(780px,95vw) !important }` and
 * `.dialog.dialog-wide { width: min(1080px,95vw) !important }`, and app.js
 * already tags the task dialog as wide — which is where the 1080 came from.
 * Because those declarations are !important, a plain rule here is silently
 * ignored no matter how specific it is, so these match the file's convention
 * and out-specify `.dialog.dialog-wide`. */
@media (min-width: 1200px) {
  .dialog.dialog-wide:has(.work-checklist),
  .dialog.dialog-wide:has(.work-items-editor),
  .dialog:has(.work-checklist) { width: min(1360px, 94vw) !important; }
}
@media (min-width: 900px) and (max-width: 1199px) {
  .dialog.dialog-wide:has(.work-checklist),
  .dialog:has(.work-checklist) { width: min(1080px, 95vw) !important; }
}

/* Tighter vertical rhythm: the dialog was spending a lot of height on padding
   and gaps while the columns had none to spare. */
.dialog:has(.work-checklist) { padding: 24px 26px; }
.dialog:has(.work-checklist) .dialog-heading { margin-bottom: 16px; }
.dialog:has(.work-checklist) fieldset { margin-top: 18px; }

/* ---------------------------------------------------------------------------
 * 2. The execution board — a full-width list
 *
 * This was a three-column kanban inside the dialog. That shape fought the
 * content: a checklist is worked one step at a time, so everything sits in
 * "To do" while two thirds of the width holds empty placeholders, and the one
 * column with content needs its own scrollbar at six items. A list gives each
 * row the whole width, keeps the steps in their numbered order, and stays
 * readable at fifteen items and at titles that run to several lines.
 * ------------------------------------------------------------------------ */
.work-checklist { margin-top: 14px; }

.work-board-caption { align-items: center; }
.work-counts { display: inline-flex; gap: 16px; flex-wrap: wrap; }
.work-counts span { display: inline-flex; align-items: center; gap: 6px; }
.work-counts .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.work-counts .d-todo { background: #b3bbcc; }
.work-counts .d-running { background: var(--purple); }
.work-counts .d-done { background: var(--green); }

.work-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  /* Roughly eight rows before scrolling; the page behind stays still. */
  max-height: min(56vh, 600px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cfcae8 transparent;
  padding-right: 4px;
}
.work-list::-webkit-scrollbar { width: 8px; }
.work-list::-webkit-scrollbar-thumb { background: #d6d2ec; border-radius: 8px; }

.work-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e6e9f2;
  border-left: 3px solid #dfe3ed;
  border-radius: 11px;
  box-shadow: var(--r-shadow-sm);
  transition: box-shadow .18s, border-color .18s;
}
.work-row:hover { box-shadow: var(--r-shadow-md); border-color: #d9d4f3; }

.work-row-step {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 9px;
  background: #f1f3f9;
  color: #5d6780;
  font-size: 12px;
  font-weight: 750;
  flex-shrink: 0;
}

.work-row-main { min-width: 0; display: grid; gap: 6px; }
.work-row-main > b {
  font-size: 13.5px;
  font-weight: 680;
  line-height: 1.45;
  color: var(--ink);
  /* Three lines is enough for a real instruction; beyond that one wordy step
     would push the rest of the list off screen. Full text stays on hover. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.work-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.work-row-when { font-size: 11.5px; color: #8a93a8; }

.work-status-tag {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f3f9;
  color: #5d6780;
}
.work-status-tag.s-in_progress { background: var(--r-purple-soft); color: #4a3fb0; }
.work-status-tag.s-paused { background: #fdf4e4; color: var(--r-amber); }
.work-status-tag.s-completed { background: #e7f6ef; color: var(--green); }

.work-row-time { display: grid; justify-items: end; gap: 1px; text-align: right; }
.work-time-label {
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9aa2b5;
}
.work-timer {
  font-size: 13px;
  font-weight: 700;
  color: #47506a;
  font-variant-numeric: tabular-nums;
}

.work-row.item-in_progress { border-left-color: var(--purple); background: #fdfcff; }
.work-row.item-in_progress .work-timer { color: var(--purple); }
.work-row.item-paused { border-left-color: #e0ae56; }
.work-row.item-completed { border-left-color: var(--green); background: #fbfdfc; }
.work-row.item-completed .work-row-main > b { color: #6c7791; text-decoration: line-through; text-decoration-color: #c3cdc8; }
.work-row.item-completed .work-row-step { background: #e7f6ef; color: var(--green); }

/* Per-item priority pill. */
.work-priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.work-priority::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.work-priority.p-low      { color: #5d6780; background: #eef0f6; border-color: #e2e6ef; }
.work-priority.p-medium   { color: #4a4bb5; background: var(--r-purple-soft); border-color: #e2ddfa; }
.work-priority.p-high     { color: var(--r-amber); background: #fdf4e4; border-color: #f6e6c8; }
.work-priority.p-critical { color: var(--r-red); background: #fdeeee; border-color: #f7d9d9; }

/* experience.css gives .work-actions a border-top and padding, which made
   sense when it sat at the bottom of a card. On a row it draws a stray rule
   beside the timer — visible even when the div is empty, which it is for
   anyone who is not the assignee. */
.work-row .work-actions {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
  justify-content: flex-end;
}
/* Reserve the button column only when there are buttons, so a read-only
   viewer sees the row end at the timer rather than at an empty gutter, while
   an assignee's rows still hold a steady width as items change state —
   Start alone and Pause+Complete together occupy the same column. */
.work-row .work-actions:not(:empty) { min-width: 178px; }
/* Size to their label instead of stretching across that column. */
.work-row .work-actions .button { flex: 0 0 auto; }

@media (max-width: 860px) {
  .work-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
  .work-row-time { grid-column: 2; justify-items: start; text-align: left; }
  .work-row .work-actions { grid-column: 2; min-width: 0; justify-content: flex-start; }
}

/* ---------------------------------------------------------------------------
 * 3. Buttons
 *
 * The originals were flat white rectangles with a single border colour. These
 * keep the same footprint and radius but add the depth, hover response and
 * press feedback the rest of the interface already has.
 * ------------------------------------------------------------------------ */
.button {
  position: relative;
  background: linear-gradient(#fff, #fcfcfe);
  border-color: #e0e3ee;
  box-shadow: var(--r-shadow-sm);
  transition: background .16s, border-color .16s, box-shadow .16s, transform .12s;
}
.button:hover:not(:disabled) {
  background: linear-gradient(#fff, #f8f7ff);
  border-color: #c9c2ee;
  box-shadow: var(--r-shadow-md);
}
.button:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--r-shadow-sm); }
.button:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

.button.primary {
  background: linear-gradient(180deg, #7361dd, var(--purple));
  border-color: #5a49c4;
  box-shadow: 0 1px 2px #3a2f8a1f, 0 6px 16px #6250cf2e;
}
.button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #7d6be6, #6858d8);
  border-color: #5443bd;
  box-shadow: 0 2px 4px #3a2f8a24, 0 10px 24px #6250cf38;
}
.button:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }

/* The Start / Pause / Complete controls sit inside a card, so they read
   better as compact pills than as full-size buttons. */
.work-actions { gap: 7px; margin-top: 3px; }
.work-actions .button {
  flex: 1 1 auto;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

/* ---------------------------------------------------------------------------
 * 4. Ownership tabs and the status filter
 *
 * Deliberately different shapes: the tabs answer "whose work is this", the
 * chips answer "what condition is it in". When both looked identical people
 * read them as one row of seven alternatives.
 * ------------------------------------------------------------------------ */
.view-tabs { gap: 4px; padding-bottom: 0; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.tab-btn {
  position: relative;
  padding: 11px 15px 13px;
  border-radius: 10px 10px 0 0;
  transition: color .15s, background .15s;
}
.tab-btn:hover { color: var(--ink); background: #fafaff; }
.tab-btn.active { color: var(--purple); font-weight: 750; }
.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2.5px;
  border-radius: 3px 3px 0 0;
  background: var(--purple);
}

.state-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}
.state-filter-label {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #8a93a8;
}
.state-chip {
  border: 1px solid #e0e3ee;
  background: linear-gradient(#fff, #fcfcfe);
  color: #4d5770;
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 650;
  min-height: 34px;
  box-shadow: var(--r-shadow-sm);
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s;
}
.state-chip:hover { border-color: #c9c2ee; background: #faf9ff; }
.state-chip.active {
  background: linear-gradient(180deg, #f4f1ff, var(--r-purple-soft));
  border-color: #c4bbf0;
  color: #4a3fb0;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 1px 3px #6250cf1a;
}
.state-filter-hint { font-size: 12.5px; color: #8a93a8; margin-left: 2px; }
@media (max-width: 760px) {
  .state-filter-hint { flex-basis: 100%; margin-left: 0; }
}

/* Shown in place of the execution controls to anyone looking at work that is
   not theirs, so the absence of buttons reads as intentional. */
.asgn-readonly {
  margin: 10px 0 0;
  padding: 10px 13px;
  background: #f7f8fc;
  border: 1px solid #e8eaf3;
  border-left: 3px solid #c9c2ee;
  border-radius: 0 9px 9px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #5c6473;
}

/* ---------------------------------------------------------------------------
 * 5. Task board (kanban)
 *
 * Same data and the same filters as the list, arranged by status.
 * ------------------------------------------------------------------------ */
.layout-toggle {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #e0e3ee;
  border-radius: 11px;
  background: #f4f5fa;
  margin-left: auto;
}
.layout-toggle button {
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 650;
  color: #68748c;
  min-height: 32px;
  transition: background .16s, color .16s, box-shadow .16s;
}
.layout-toggle button.active {
  background: #fff;
  color: var(--purple);
  box-shadow: var(--r-shadow-sm);
}

.task-kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(276px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: #cfcae8 transparent;
}
.kanban-col {
  background: #f7f8fc;
  border: 1px solid #e8eaf3;
  border-radius: 15px;
  padding: 12px 10px;
  min-height: 140px;
  max-height: min(66vh, 760px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.kanban-col-head {
  position: sticky;
  top: -12px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -12px -10px 10px;
  padding: 12px 12px 10px;
  background: linear-gradient(#f7f8fc 78%, #f7f8fc00);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #5d6780;
}
.kanban-col-head .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-head .count {
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 7px;
  background: #e9ebf5;
  font-size: 12px;
}
.kanban-col[data-status="ASSIGNED"]            { background: #f7f8fc; }
.kanban-col[data-status="IN_PROGRESS"]         { background: #f4f2ff; border-color: #e3dffb; }
.kanban-col[data-status="PARTIALLY_COMPLETED"] { background: #fff8ec; border-color: #f5e7cd; }
.kanban-col[data-status="OVERDUE"]             { background: #fdf1f1; border-color: #f6dcdc; }
.kanban-col[data-status="COMPLETED"]           { background: #f1faf6; border-color: #dcefe6; }

.kanban-card {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e6e9f2;
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 9px;
  box-shadow: var(--r-shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.kanban-card:hover {
  box-shadow: var(--r-shadow-md);
  border-color: #d3ccf1;
  transform: translateY(-1px);
}
.kanban-card:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.kanban-card .k-id {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .05em;
  color: #8a93a8;
}
.kanban-card .k-title {
  font-size: 13.5px;
  font-weight: 680;
  line-height: 1.45;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.kanban-card .k-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: #68748c;
}
.kanban-card .k-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f2f7;
  font-size: 11.5px;
  color: #68748c;
}
.kanban-card .k-avatar {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #f2b198, #df7a78);
  color: #fff;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 800;
  flex-shrink: 0;
}
.kanban-card .k-due.overdue { color: var(--r-red); font-weight: 700; }
.kanban-card .k-progress {
  height: 5px;
  border-radius: 6px;
  background: #edf0f6;
  overflow: hidden;
}
.kanban-card .k-progress span {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #8b84f2, var(--purple));
}
.kanban-empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 12.5px;
  color: #98a0b3;
}

@media (max-width: 760px) {
  .task-kanban { grid-auto-columns: minmax(250px, 78vw); }
  .layout-toggle { margin-left: 0; }
}

/* ---------------------------------------------------------------------------
 * 6. Conversation
 * ------------------------------------------------------------------------ */
.task-conversation h3 { font-size: 15px; margin: 0 0 4px; }
.comment {
  background: #f7f8fc;
  border: 1px solid #eceef6;
  border-radius: 11px;
  padding: 12px 14px;
}
.comment > b { font-size: 13px; }
.comment p { margin: 5px 0 0; font-size: 13.5px; line-height: 1.55; color: #3c4560; }
.comment.mine { background: var(--r-purple-soft); border-color: #e4dffb; }

/* ---------------------------------------------------------------------------
 * 7. Destructive actions
 *
 * Cancelling a task is not the same weight as saving an edit, so it sits in
 * its own band with its own colour rather than as one more button in a row.
 * ------------------------------------------------------------------------ */
.edit-danger {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid #f3dede;
  border-radius: 12px;
  background: #fdf7f7;
}
.edit-danger > div { flex: 1 1 260px; min-width: 0; }
.edit-danger b { display: block; font-size: 13.5px; color: #8f3b3b; }
.edit-danger p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.5; color: #8a7676; }

.button.danger {
  background: linear-gradient(#fff, #fdf6f6);
  border-color: #eccccc;
  color: var(--r-red);
}
.button.danger:hover:not(:disabled) {
  background: linear-gradient(#fff, #fdefef);
  border-color: #e0a9a9;
  box-shadow: 0 2px 4px #d143430f, 0 8px 20px #d1434320;
}

.danger-note {
  margin: 0 0 16px;
  padding: 11px 13px;
  border: 1px solid #f3dede;
  border-left: 3px solid var(--r-red);
  border-radius: 0 9px 9px 0;
  background: #fdf7f7;
  font-size: 13px;
  line-height: 1.5;
  color: #8f3b3b;
}

/* ---------------------------------------------------------------------------
   8. Paged lists
   The task list is served a page at a time, so it must say when there is more
   rather than ending silently at an arbitrary row.
   --------------------------------------------------------------------------- */

.list-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 12px 6px;
  flex-wrap: wrap;
}

.list-more span {
  color: #6b6480;
  font-size: 13px;
  font-weight: 600;
}
