/* MyTask theme, v2: neutral surfaces + indigo accent, iOS-flavored shapes.
   Light and dark share every rule; the html[data-theme="dark"] block only swaps
   tokens. --navy is the historical var name for the DARK surface tone. */

:root {
  --bg: #F4F4F6;
  --bg-card: #FFFFFF;
  --field: #F1F1F4;
  --ink: #33333A;
  --ink-strong: #121216;
  --ink-muted: #8A8A93;
  --accent: #5A5CE6;
  --accent-dark: #4547C9;
  --accent-soft: #EBEBFC;
  --navy: #17171E;
  --navy-hover: #2A2A36;
  --navy-soft: #ECECF2;
  --rose: #B9BAF3;
  --ok: #2EA562;
  --ok-soft: #E2F5EA;
  --warn: #C97E1E;
  --warn-soft: #FCF0DD;
  --err: #DC4C41;
  --err-soft: #FBE7E5;
  --line: #E7E7EC;
  /* priority colors (same in both themes) */
  --prio-low: #3B82F6;
  --prio-medium: #F59E0B;
  --prio-high: #F97316;
  --prio-urgent: #DC2626;
  --radius: 16px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(18, 18, 22, .05);
  --shadow-lift: 0 12px 32px rgba(18, 18, 22, .16);
  --backdrop: rgba(10, 10, 14, .6);
}

html[data-theme="dark"] {
  --bg: #131318;
  --bg-card: #1C1C23;
  --field: #26262F;
  --ink: #D6D6DE;
  --ink-strong: #F5F5F8;
  --ink-muted: #85858F;
  --accent: #7B7DF5;
  --accent-dark: #999BF8;
  --accent-soft: #2B2B4A;
  --navy: #0E0E13;
  --navy-hover: #23232E;
  --navy-soft: #262635;
  --rose: #4A4B84;
  --ok: #3FCF7A;
  --ok-soft: #17301F;
  --warn: #E5A44A;
  --warn-soft: #33291A;
  --err: #F26B60;
  --err-soft: #3B211E;
  --line: #2C2C36;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, .5);
  --backdrop: rgba(0, 0, 0, .72);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 { color: var(--ink-strong); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 .3rem; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 .8rem; }
a { color: var(--ink-strong); }
.muted { color: var(--ink-muted); }
.big { font-size: 1.5rem; font-weight: 700; color: var(--ink-strong); margin: .2rem 0; }
.right { text-align: right; }
.inline { display: inline; }
.small-note { font-size: .84rem; }
.center { text-align: center; }
.grow { flex: 1; }
.hidden-form { display: none; }

/* ---------- top bar ---------- */
.topbar { background: var(--navy); }
.topbar-inner {
  max-width: 1560px; margin: 0 auto; padding: .55rem 1.2rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { font-size: 1.12rem; font-weight: 800; color: #fff; text-decoration: none; letter-spacing: -0.01em; }
.brand::after { content: "."; color: var(--accent); }
.nav { display: flex; align-items: center; gap: .9rem; }
.nav a { text-decoration: none; color: rgba(255, 255, 255, .72); font-size: .93rem; font-weight: 500; }
.nav a:hover { color: #fff; }
.nav-sa { color: var(--accent) !important; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.topbar .topsearch input[type="search"] {
  width: 170px; padding: .38rem .8rem; margin: 0; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.1); color: #fff; font: inherit; font-size: .88rem;
}
.topbar .topsearch input[type="search"]::placeholder { color: rgba(255, 255, 255, .5); }
.topbar .topsearch input[type="search"]:focus {
  outline: none; background: var(--bg-card); color: var(--ink);
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.avatar {
  display: inline-flex; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; align-items: center; justify-content: center;
  text-decoration: none; font-weight: 700; font-size: .85rem;
}
.theme-toggle {
  background: none; border: none; cursor: pointer; padding: .3rem;
  color: rgba(255, 255, 255, .72); display: inline-flex; align-items: center; font-size: 1rem;
}
.theme-toggle:hover { color: #fff; }
.tt-sun { display: none; }
html[data-theme="dark"] .tt-sun { display: inline; }
html[data-theme="dark"] .tt-moon { display: none; }
.linklike { background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.linklike:hover { color: var(--accent-dark); }

/* bell */
.bell-wrap { position: relative; }
.bell { position: relative; background: none; border: none; cursor: pointer; color: rgba(255, 255, 255, .72); padding: .3rem; }
.bell:hover { color: #fff; }
.bell-badge {
  position: absolute; top: -2px; right: -4px; background: var(--accent); color: #fff;
  font-size: .66rem; font-weight: 700; border-radius: 999px; padding: 0 .32rem; line-height: 1.4;
}
.bell-menu {
  position: absolute; right: 0; top: 2.3rem; width: 330px; max-width: 88vw; z-index: 50;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); overflow: hidden;
}
.bell-item { display: block; padding: .6rem .9rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); font-size: .88rem; }
.bell-item small { display: block; }
.bell-item.unread { background: var(--accent-soft); }
.bell-item:hover { background: var(--bg); }
.bell-empty { padding: .8rem .9rem; margin: 0; }
.bell-all { display: block; text-align: center; padding: .55rem; font-size: .88rem; text-decoration: none; font-weight: 600; }

/* ---------- layout ---------- */
.main { max-width: 1560px; margin: 1.3rem auto 3rem; padding: 0 1.2rem; }
.page-head { margin-bottom: 1rem; }
.footer { text-align: center; color: var(--ink-muted); font-size: .84rem; padding: 1.5rem 0 2rem; }
.footer a { color: var(--ink-muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
}

/* ---------- forms (iOS-style filled fields) ---------- */
label { display: block; margin-bottom: .85rem; font-weight: 600; font-size: .88rem; color: var(--ink-strong); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  padding: .55rem .8rem; font: inherit; font-weight: 400;
  border: 1px solid transparent; border-radius: var(--radius-s); background: var(--field);
  color: var(--ink);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; background: var(--bg-card); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled { background: var(--bg); color: var(--ink-muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }
input[type="date"] { accent-color: var(--accent); cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238A8A93' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center;
  padding-right: 1.7rem;
}
small { font-weight: 400; }
.form-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.form-row input, .form-row select { width: auto; flex: 1; min-width: 140px; margin-top: 0; }
.check-inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; font-size: .88rem; margin: 0; color: var(--ink); }
.check-inline input { width: auto; display: inline; margin: 0; }

.btn {
  display: inline-block; padding: .48rem 1.05rem; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-strong);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none;
  transition: transform .05s ease, background .12s ease, border-color .12s ease, filter .12s ease;
}
.btn:hover { border-color: var(--ink-muted); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-hover); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-block { width: 100%; }
.btn-small { padding: .28rem .75rem; font-size: .82rem; }
.btn-big { font-size: 1.05rem; padding: .72rem 1.6rem; }
.btn-active { background: var(--navy-soft); border-color: var(--navy); }

/* ---------- tables & chips ---------- */
.table { width: 100%; border-collapse: collapse; }
.table td { padding: .6rem .4rem; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:first-child td { border-top: none; }
.row-muted { opacity: .55; }
.chip {
  display: inline-block; background: var(--navy-soft); color: var(--ink-strong);
  border-radius: 999px; padding: .08rem .6rem; font-size: .78rem; font-weight: 600;
}
.chip-plain { background: var(--bg); color: var(--ink-muted); }
.chip-hand { background: var(--accent-soft); color: var(--accent-dark); }
.chip-unassigned { background: var(--bg); color: var(--ink-muted); border: 1px dashed var(--line); }
.chip-orphan { background: var(--err-soft); color: var(--err); }
.company-dot { display: inline-block; width: .7em; height: .7em; border-radius: 3px; margin-right: .3em; }

/* status */
.st { display: inline-block; border-radius: 999px; padding: .08rem .6rem; font-size: .78rem; font-weight: 700; }
.st-open     { background: var(--navy-soft); color: var(--ink-strong); }
.st-progress { background: color-mix(in srgb, var(--prio-low) 14%, transparent); color: var(--prio-low); }
.st-handed   { background: var(--accent-soft); color: var(--accent-dark); }
.st-done     { background: var(--ok-soft); color: var(--ok); }

/* priority */
.prio { font-size: .74rem; border-radius: 999px; padding: .06rem .55rem; font-weight: 700; }
.prio-low    { background: var(--prio-low); color: #fff; }
.prio-medium { background: var(--prio-medium); color: #fff; }
.prio-high   { background: var(--prio-high); color: #fff; }
.prio-urgent { background: var(--prio-urgent); color: #fff; }

/* formatted date over the native picker */
.datefield { position: relative; display: block; margin-top: .3rem; }
.datefield input[type="date"] { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.datefield-text {
  display: block; padding: .55rem .8rem; border-radius: var(--radius-s);
  background: var(--field); border: 1px solid transparent; font-weight: 400;
}
.datefield:focus-within .datefield-text { background: var(--bg-card); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.due { font-size: .8rem; color: var(--ink-muted); font-weight: 600; }
.due-soon { color: var(--warn); }
.due-over { color: var(--err); }

/* flash */
.flash { border-radius: var(--radius-s); padding: .65rem 1rem; margin-bottom: 1rem; font-size: .92rem; font-weight: 500; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error   { background: var(--err-soft); color: var(--err); }
.flash-info    { background: var(--navy-soft); color: var(--ink-strong); }
.toast { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 200; box-shadow: var(--shadow-lift); }

/* ---------- TASKS: split pane (Microsoft To Do style) ---------- */
.tasks-wrap { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) {
  .tasks-wrap { grid-template-columns: 1fr; }
  .tasks-wrap.has-selection .tasks-left { display: none; }  /* mobile: show detail full width */
}

.tasks-left { min-width: 0; }

/* smart view chips: My Day / Important / Planned / All */
.view-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .7rem; }
.view-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .32rem .85rem; border-radius: 999px; text-decoration: none;
  background: var(--bg-card); border: 1px solid var(--line);
  font-size: .86rem; font-weight: 600; color: var(--ink);
  transition: border-color .12s ease, background .12s ease;
}
.view-chip:hover { border-color: var(--ink-muted); }
.view-chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.view-chip-icon { font-size: .95em; }

/* quick add: type, Enter, done */
.quick-add {
  display: flex; align-items: center; gap: .55rem;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .5rem .8rem; margin-bottom: .7rem;
}
.qa-plus { color: var(--accent); font-weight: 700; font-size: 1.2rem; line-height: 1; }
.quick-add input[type="text"], .quick-add input[type="text"]:focus {
  flex: 1; margin: 0; padding: .25rem .2rem; border: none; background: transparent; box-shadow: none;
}

/* importance star */
.star {
  flex: none; background: none; border: none; cursor: pointer; padding: 0 .1rem;
  font-size: 1.05rem; line-height: 1; color: var(--ink-muted); opacity: .55;
  transition: color .12s ease, opacity .12s ease;
}
.star:hover { color: var(--prio-medium); opacity: 1; }
.star.on { color: var(--prio-medium); opacity: 1; }
.star-big { font-size: 1.35rem; margin-top: .15rem; }
.tasks-toolbar { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .7rem; }
.tasks-filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tasks-filters select { width: auto; margin: 0; padding: .35rem 1.7rem .35rem .65rem; font-size: .86rem; border-radius: 999px; }
.tasks-toolbar .btn-newtask { text-align: center; }

.tasklist { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.trow {
  display: flex; align-items: center; gap: .65rem; padding: .62rem .8rem;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink);
  transition: background .1s ease; cursor: pointer;
}
.trow:last-child { border-bottom: none; }
.trow:hover { background: var(--bg); }
.trow.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.bulk-check { flex: none; opacity: 0; transition: opacity .12s ease; }
.trow:hover .bulk-check, .bulk-check:checked, .tasklist.bulk-mode .bulk-check { opacity: 1; }

/* bulk actions bar */
.bulkbar {
  position: sticky; bottom: .8rem; z-index: 30;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  background: var(--navy); color: #fff; border-radius: 14px;
  padding: .5rem .8rem; margin-top: .8rem; box-shadow: var(--shadow-lift);
}
.bulkbar select { width: auto; margin: 0; padding: .3rem 1.7rem .3rem .55rem; font-size: .84rem; }
.bulkbar .btn:not(.btn-danger) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.bulkbar .btn:not(.btn-danger):hover { border-color: #fff; }

/* instant info popover */
.info-wrap { position: relative; display: inline-flex; }
.info-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 21px; height: 21px; border-radius: 50%; flex: none;
  color: var(--ink-muted); cursor: help;
}
.info-dot:hover { color: var(--ink-strong); }
.info-pop {
  display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 70;
  width: 300px; padding: .75rem .95rem .85rem;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-s);
  box-shadow: var(--shadow-lift); font-size: .8rem; font-weight: 400; color: var(--ink);
  cursor: default;
}
.info-wrap:hover .info-pop, .info-wrap:focus-within .info-pop { display: block; }
.info-pop strong { display: block; margin-top: .55rem; color: var(--ink-strong); }
.info-pop strong:first-child { margin-top: 0; }
.info-pop span { display: block; color: var(--ink-muted); line-height: 1.45; }

/* inline workspace mover in the task byline */
.ws-inline-select {
  display: inline-block; width: auto; margin: 0; padding: 0 1.3rem 0 .15rem;
  border: none; background-color: transparent; box-shadow: none;
  font-size: .84rem; font-weight: 600; color: var(--ink-muted); cursor: pointer;
  background-position: right .25rem center;
}
.ws-inline-select:hover { color: var(--ink-strong); }
.ws-inline-select:focus { background-color: var(--bg-card); border: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.trow-main { flex: 1; min-width: 0; }
.trow-title { font-weight: 600; color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow-sub { font-size: .78rem; color: var(--ink-muted); display: flex; gap: .55rem; align-items: center; margin-top: .1rem; }
.trow-comp { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: .3em; }
.trow.done-row .trow-title { text-decoration: line-through; color: var(--ink-muted); font-weight: 500; }

/* the round done-checkbox at the start of each row */
.donebox {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  border: 2px solid var(--ink-muted); background: var(--bg-card); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 800; color: transparent; padding: 0;
  transition: all .12s ease;
}
.donebox:hover { border-color: var(--ok); color: var(--ok); }
.donebox.checked { background: var(--ok); border-color: var(--ok); color: #fff; }

/* assignee circle */
.pcircle {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; color: #fff; background: var(--navy);
}
.pcircle.empty { background: transparent; border: 1.5px dashed var(--ink-muted); color: var(--ink-muted); }

.done-sep {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem;
  background: var(--bg); border-bottom: 1px solid var(--line);
  font-size: .8rem; font-weight: 700; color: var(--ink-muted); cursor: pointer; user-select: none;
}
.tasklist-empty { padding: 2.6rem 1.4rem; text-align: center; }
.tasklist-empty p { color: var(--ink-muted); margin: .4rem 0 1rem; }

/* ---------- task detail panel ---------- */
.taskpane { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.4rem; min-width: 0; }
.taskpane-empty { display: flex; align-items: center; justify-content: center; min-height: 300px; color: var(--ink-muted); border-style: dashed; box-shadow: none; background: transparent; }
.taskpane-head { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: .4rem; }
.taskpane-head h1 { font-size: 1.3rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.taskpane-head .done-row-title { text-decoration: line-through; color: var(--ink-muted); }
.sec {
  border-top: 1px solid var(--line); padding: .9rem 0;
}
.sec-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; }
.sec-label { font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); }
.edit-btn {
  margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: .12rem .55rem; font-size: .76rem; font-weight: 600; color: var(--ink-muted); cursor: pointer;
}
.edit-btn:hover { color: var(--ink-strong); border-color: var(--ink-muted); }
/* two columns inside the pane: main content + attachments sidebar */
.taskpane-cols { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 1.4rem; align-items: stretch; margin-top: .6rem; }
@media (max-width: 1150px) { .taskpane-cols { grid-template-columns: 1fr; } }
.taskpane-main { min-width: 0; }
.taskpane-side { min-width: 0; display: flex; flex-direction: column; gap: .6rem; }

.title-wrap { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: .45rem; }
.title-wrap h1 { flex: 0 1 auto; }
.title-input { font-size: 1.3rem; font-weight: 700; color: var(--ink-strong); flex: 1; margin-top: 0; }
.hover-edit { opacity: 0; transition: opacity .12s ease; }
.taskpane-head:hover .hover-edit, .sec-hoveredit:hover .hover-edit,
.field-view:hover .hover-edit, .hover-edit:focus-visible { opacity: 1; }

/* read-only field display styled like a filled input; pencil sits inside */
.field-view { position: relative; display: block; margin-top: .3rem; }
.field-view-text {
  display: block; padding: .55rem 2.1rem .55rem .8rem; border-radius: var(--radius-s);
  background: var(--field); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.field-view .edit-btn { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); margin: 0; background: var(--bg-card); }
.field-view-click { cursor: pointer; }
.field-view-click:hover .field-view-text { box-shadow: 0 0 0 2px var(--accent-soft); }

.meta-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: .8rem; margin: .7rem 0 .3rem; }
.meta-row-2 { grid-template-columns: 1fr 1fr; max-width: 66%; }
@media (max-width: 700px) { .meta-row, .meta-row-2 { grid-template-columns: 1fr; max-width: none; } }
.meta-row > label { margin: 0; }

.check-pending .check-body { color: var(--ink-muted); }
.tag-pending { border: 1px dashed var(--ink-muted); }
.tag-chip { background: var(--navy-soft); color: var(--ink-strong); }

/* ghost row that nudges toward the next checklist item */
.check-add-row { opacity: .45; transition: opacity .12s ease; }
.check-add-row:hover, .check-add-row:focus-within { opacity: 1; }
.check-add-dot { border-style: dashed; color: var(--ink-muted); font-size: .8rem; cursor: default; display: inline-flex; align-items: center; justify-content: center; }
.check-add-input, .check-add-input:focus {
  border: none; background: transparent; box-shadow: none; margin: 0; padding: .2rem .1rem; flex: 1;
}

/* sticky save / undo bar for pending edits */
.savebar {
  position: sticky; bottom: .8rem; z-index: 30;
  display: flex; gap: .55rem; align-items: center; justify-content: flex-end;
  background: var(--navy); color: #fff; border-radius: 999px;
  padding: .5rem .6rem .5rem 1.1rem; margin-top: 1rem; box-shadow: var(--shadow-lift);
}
.savebar-note { margin-right: auto; font-size: .86rem; font-weight: 600; }
.savebar .btn { border-radius: 999px; }
.savebar .btn:not(.btn-primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.savebar .btn:not(.btn-primary):hover { border-color: #fff; }

.ticket-desc { line-height: 1.6; overflow-wrap: anywhere; }
.ticket-desc code, .comment-body code { background: var(--field); border-radius: 5px; padding: .05rem .35rem; font-size: .9em; }
hr.soft { border: none; border-top: 1px solid var(--line); margin: .9rem 0; }

.check-row { display: flex; align-items: center; gap: .55rem; padding: .28rem 0; }
.check-done .check-body { text-decoration: line-through; color: var(--ink-muted); }
.check-body { flex: 1; overflow-wrap: anywhere; }
.checkbox-btn {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-muted);
  background: var(--bg-card); color: transparent; font-weight: 800; font-size: .65rem; cursor: pointer; padding: 0;
}
.checkbox-btn:hover { border-color: var(--ok); color: var(--ok); }
.check-done .checkbox-btn { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-assign-sel { display: inline-block; width: auto; flex: none; padding: .12rem 1.5rem .12rem .45rem; font-size: .78rem; margin: 0; border-radius: 999px; }

/* attachments: uniform rounded cards stacked in the side column */
.att-stack { display: flex; flex-direction: column; gap: .5rem; }
.att-card { position: relative; min-width: 0; }
.att-del {
  position: absolute; top: -7px; right: -7px; z-index: 5;
  width: 21px; height: 21px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--err); color: #fff; font-size: .85rem; line-height: 1; padding: 0;
  box-shadow: var(--shadow); display: none;
}
.att-card:hover .att-del { display: block; }
.att-open {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 15px; background: var(--bg-card);
  padding: .5rem .6rem; cursor: pointer; font: inherit; color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.att-open:hover { border-color: var(--rose); box-shadow: var(--shadow); }
.att-thumb {
  flex: none; width: 48px; height: 48px; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft);
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-ext { font-weight: 800; font-size: .68rem; letter-spacing: .04em; color: var(--accent-dark); }
.att-info { min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.att-name {
  font-size: .8rem; font-weight: 600; line-height: 1.3; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere;
}
.att-meta { font-size: .7rem; color: var(--ink-muted); }

/* upload dropzone: click, drag & drop, or paste. Fills the rest of the column. */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  flex: 1; min-height: 150px; padding: 1.1rem .9rem; text-align: center;
  border: 2px dashed var(--rose); border-radius: 15px;
  background: var(--bg-card); color: var(--ink-muted);
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.dz-icon { font-size: 1.4rem; }
.dz-file { display: none; }
.dropzone-sm { flex: none; min-height: 90px; }

/* markdown typography toolbar */
.md-toolbar { display: flex; gap: .3rem; margin: .35rem 0 .4rem; }
.md-toolbar button {
  background: var(--field); border: 1px solid var(--line); border-radius: 8px;
  min-width: 34px; padding: .18rem .5rem; font: inherit; font-size: .82rem;
  color: var(--ink); cursor: pointer;
}
.md-toolbar button:hover { border-color: var(--accent); color: var(--accent-dark); }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: var(--backdrop);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem;
}
.lightbox-inner { min-width: min(420px, 90vw); max-width: min(1000px, 94vw); max-height: 92vh; display: flex; flex-direction: column; gap: .6rem; }
.lightbox-bar { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.lightbox-name { color: #fff; margin-right: auto; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.lightbox-body { overflow: auto; display: flex; align-items: center; justify-content: center; }
.lightbox-body img { max-width: 100%; max-height: 80vh; border-radius: 10px; background: var(--bg-card); }
.lb-frame { width: min(920px, 92vw); height: 82vh; border: none; border-radius: 10px; background: #fff; }
.lightbox-nopreview {
  color: var(--ink); background: var(--bg-card); border-radius: var(--radius-s);
  font-size: .95rem; padding: 1.6rem 2rem; max-width: 340px; text-align: center;
}

.comment { border-top: 1px solid var(--line); padding: .75rem 0; }
.comment:first-of-type { border-top: none; }
.comment-head { display: flex; gap: .6rem; align-items: baseline; font-size: .9rem; }
.comment-actions { margin-left: auto; display: flex; gap: .6rem; font-size: .82rem; }
.comment-body { margin-top: .25rem; line-height: 1.55; overflow-wrap: anywhere; }
.comment-deleted { font-style: italic; }
.comment-new textarea, .comment-edit-form textarea { width: 100%; margin-bottom: .5rem; }
.mention { color: var(--accent-dark); font-weight: 700; background: var(--accent-soft); border-radius: 5px; padding: 0 .2rem; }
.mention-menu { position: relative; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: var(--shadow-lift); max-width: 240px; z-index: 40; }
.mention-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: .45rem .8rem; font: inherit; color: var(--ink); cursor: pointer; }
.mention-menu button:hover { background: var(--navy-soft); }

.tagline { display: flex; gap: .35rem; flex-wrap: wrap; margin: .3rem 0 .45rem; }
.tag-chip { border: none; cursor: pointer; font: inherit; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .08rem .55rem; }

/* chip-style tag editor (create form): Enter or comma makes a bubble */
.tag-editor {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
  margin-top: .3rem; padding: .4rem .55rem; cursor: text;
  background: var(--field); border: 1px solid transparent; border-radius: var(--radius-s);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.tag-editor:focus-within { background: var(--bg-card); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-editor input[type="text"], .tag-editor input[type="text"]:focus {
  flex: 1; min-width: 130px; width: auto; margin: 0; padding: .15rem .2rem;
  border: none; background: transparent; box-shadow: none;
}
.tag-editor-chip { display: inline-flex; align-items: center; gap: .3rem; cursor: default; user-select: none; }
.tag-x { background: none; border: none; cursor: pointer; font: inherit; color: inherit; padding: 0; line-height: 1; opacity: .7; }
.tag-x:hover { opacity: 1; }
.tag-editor-wrap { position: relative; }
.tag-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 60; min-width: 220px; max-width: 100%;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-s);
  box-shadow: var(--shadow-lift); overflow: hidden;
}
.tag-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: .45rem .8rem; font: inherit; color: var(--ink); cursor: pointer;
}
.tag-menu button:hover, .tag-menu button.active { background: var(--accent-soft); }

.activity { list-style: none; padding: 0; margin: .5rem 0 0; }
.activity li { padding: .3rem 0; font-size: .87rem; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: none; }
.activity.feed li a { text-decoration: none; }

/* AI panel */
.ai-panel { border: 1px solid var(--accent); background: linear-gradient(180deg, var(--bg-card), var(--accent-soft)); }
.ai-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.ai-tone { margin-bottom: .5rem; display: flex; gap: .8rem; }
#ai-output { width: 100%; margin-bottom: .5rem; font-size: .9rem; }
.ai-spark { font-size: .85rem; }

/* ---------- overview board ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 950px) { .board { grid-template-columns: 1fr; } }
.board-col { background: var(--navy-soft); border-radius: var(--radius); padding: .55rem; min-height: 120px; }
.board-col-head { font-weight: 700; font-size: .85rem; padding: .2rem .4rem .55rem; display: flex; justify-content: space-between; color: var(--ink-strong); }
.board-cards { display: flex; flex-direction: column; gap: .55rem; min-height: 60px; }
.board-empty { font-size: .85rem; padding: .4rem; }
.drop-hint { outline: 2px dashed var(--accent); outline-offset: -4px; }
.dragging { opacity: .5; }
.dash-lower { margin-top: 1.2rem; align-items: start; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; }
.tcard {
  display: block; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .75rem .9rem; text-decoration: none; color: var(--ink);
  transition: transform .08s ease, box-shadow .12s ease;
}
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tcard-archived { opacity: .55; }
.tcard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.tcard-title { font-weight: 600; margin-bottom: .4rem; line-height: 1.35; color: var(--ink-strong); }
.tcard-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .82rem; }
.myitem { padding: .4rem 0; border-top: 1px solid var(--line); }
.myitem:first-child { border-top: none; }
.myitem a { text-decoration: none; color: var(--ink); }
.myitem small { display: block; }
.unassigned-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.unassigned-row:first-child { border-top: none; }
.unassigned-row a { text-decoration: none; color: var(--ink); }
.section-h { margin: 1.4rem 0 .7rem; font-weight: 700; color: var(--ink-strong); }

/* filters (secondary pages) */
.filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .7rem .9rem; }
.filters select { width: auto; margin-top: 0; padding: .32rem 1.7rem .32rem .5rem; font-size: .87rem; }
.filters-right { margin-left: auto; display: flex; gap: .4rem; }
.ttable td { font-size: .92rem; }

/* misc */
.danger-zone { border-color: var(--err-soft); }
.empty-state { text-align: center; padding: 2.2rem 1.5rem; }
.narrow-card { max-width: 640px; }
.tpl-details { margin-bottom: .6rem; }
.tpl-details summary { cursor: pointer; padding: .3rem 0; }
.search-comment { border-top: 1px solid var(--line); padding: .6rem 0; }
.search-comment:first-child { border-top: none; }
.search-comment a { text-decoration: none; color: var(--ink); }
.notif-row { display: flex; justify-content: space-between; gap: .8rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.notif-row:first-child { border-top: none; }
.notif-row.unread { font-weight: 600; }
.notif-row a { color: var(--ink); text-decoration: none; }
.prefs-table td { text-align: center; }
.prefs-table td:first-child { text-align: left; }
.plan-row { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; border-top: 1px solid var(--line); padding: .7rem 0; }
.plan-row label { font-size: .76rem; margin: 0; }
.plan-row input { width: 90px; margin-top: .15rem; padding: .3rem .45rem; }
.plan-name { min-width: 70px; }
.onboard-wrap { max-width: 520px; margin: 0 auto; }
.thead-flex { display: flex; justify-content: space-between; align-items: start; gap: 1rem; flex-wrap: wrap; }

/* ---------- public / landing ---------- */
.public { display: block; }
.pub-header { max-width: 1020px; margin: 0 auto; padding: 1rem 1.2rem; display: flex; align-items: center; }
.pub-header .brand { color: var(--ink-strong); font-size: 1.3rem; }
.pub-header .nav { margin-left: auto; display: flex; gap: 1rem; align-items: center; }
.pub-header .nav a { color: var(--ink); }
.pub-main { max-width: 1020px; margin: 0 auto; padding: 0 1.2rem 3rem; }
.hero { text-align: center; padding: 4.2rem 0 3.2rem; }
.hero-title { font-size: clamp(2.1rem, 6vw, 3.4rem); margin: 0 0 1rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.hero-accent { color: var(--accent); font-style: normal; }
.hero-sub { font-size: 1.12rem; color: var(--ink-muted); max-width: 560px; margin: 0 auto 1.6rem; }
.feature-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 2.4rem 0; }
@media (max-width: 800px) { .feature-strip { grid-template-columns: 1fr; } }
.feature { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; }
.feature-demo { margin-top: .9rem; padding: .7rem; background: var(--bg); border-radius: var(--radius-s); display: flex; gap: .5rem; align-items: center; }
.pricing { margin-top: 2.8rem; text-align: center; }
.pricing h2 { font-size: 1.8rem; }
.pricing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 300px)); gap: 1rem; justify-content: center; margin: 1.3rem 0 1rem; }
.price-card { text-align: left; }
.price-featured { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.price-big { font-size: 2.1rem; font-weight: 800; color: var(--ink-strong); }
.price-line { margin: .4rem 0 .8rem; }
.price-list { list-style: none; padding: 0; margin: 0 0 1.1rem; }
.price-list li { padding: .25rem 0; border-top: 1px solid var(--line); font-size: .9rem; }
.price-list li:first-child { border-top: none; }

/* legal */
.legal-body h2 { margin-top: 1.6rem; }

/* ---------- auth screens ---------- */
.bare { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--navy); }
.auth-wrap { width: 100%; max-width: 430px; padding: 1.2rem; }
.auth-brand { text-align: center; font-size: 1.5rem; font-weight: 800; color: #fff; margin-bottom: 1rem; }
.auth-brand::after { content: "."; color: var(--accent); }
.auth-card { padding: 1.6rem 1.6rem 1.3rem; }
.auth-links { text-align: center; font-size: .9rem; margin-top: 1rem; }
