:root {
  --bg: #f4f2ee;
  --header: #1e3a34;
  --card: #fff;
  --text: #1c1c1c;
  --muted: #6a6a6a;
  --accent: #2c6e57;
  --urgent: #b42318;
  --line: #d8d3c8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 "Segoe UI", system-ui, sans-serif; }
body { padding-bottom: 72px; }
.top { background: var(--header); color: #fff; padding: 12px 16px 10px; }
.top-row { display: flex; justify-content: space-between; align-items: center; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.who { margin-top: 8px; }
.who-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.who-role { font-size: 13px; opacity: 0.8; margin-top: 2px; }
.push-warn {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff3e0;
  border: 1px solid #e65100;
  color: #bf360c;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.linkish { background: none; border: 0; color: #fff; font: inherit; }
main { padding: 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}
.page-head h1 { margin: 0; flex: 1; min-width: 0; }
.assignee-picker {
  display: block;
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.assignee-picker select {
  min-height: 48px;
  font-size: 16px;
  margin-top: 6px;
  -webkit-appearance: menulist;
  appearance: auto;
}
h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.flash { background: #fde8e6; color: var(--urgent); padding: 10px 16px; }
.flash.ok { background: #e7f4ee; color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.card-warn { border-color: #ead48a; background: #fffdf3; }
.phone-missing { color: var(--urgent); font-weight: 700; margin: 8px 0 4px; }
a.secondary {
  display: inline-block; width: 100%; margin: 8px 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--text); text-align: center; text-decoration: none; font: inherit;
}
.test-hint {
  background: #fff6d9;
  border: 1px solid #ead48a;
  border-radius: 12px;
  margin: 0 0 12px;
  padding: 12px;
}
.test-hint p { margin: 6px 0 0; }
label { display: block; margin: 8px 0; font-size: 14px; color: var(--muted); }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: #fff;
}
.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.check input { width: auto; }
.form-line {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.form-line > label { flex: 1; min-width: 0; margin: 8px 0; }
.form-line > .check {
  flex: 0 0 auto;
  margin: 8px 0;
  padding-bottom: 10px;
  white-space: nowrap;
}
button, .primary {
  display: inline-block; width: 100%; margin: 8px 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit;
}
.primary { background: var(--accent); color: #fff; border: 0; }
.danger { color: var(--urgent); }
.task {
  display: flex; align-items: stretch; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; margin: 8px 0; color: inherit; text-decoration: none;
}
.task-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
}
.task-line .when {
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  padding-top: 2px;
}
.task-line .task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.task-line .title {
  flex: 1;
  min-width: 0;
  margin: 0;
  line-height: 1.35;
}
.task-line.done .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-mail {
  font-size: 14px;
  vertical-align: middle;
  display: inline-block;
}
.task-countdown {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  white-space: nowrap;
}
.remind-toggle .remind-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.remind-toggle .remind-options button {
  flex: 1 1 72px;
  min-width: 72px;
}
.task-mail-blink {
  animation: task-mail-blink 1s ease-in-out infinite;
}
@keyframes task-mail-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.2); }
}
@media (prefers-reduced-motion: reduce) {
  .task-mail-blink { animation: none; opacity: 1; }
}
.task-body { flex: 1; min-width: 0; }
.task-main { display: block; color: inherit; text-decoration: none; }
.task-people {
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; flex: 0 1 auto; max-width: 100%; min-width: 0;
}
.task.urgent {
  border-color: var(--urgent);
  background: #fde8e6;
  color: #5c1210;
}
.task.urgent .when,
.task.urgent .who-line { color: #7a1c18; }
.task.personal {
  border-style: dashed;
  border-color: var(--accent);
  background: #eef6f2;
}
.task.personal .when,
.task.personal .who-line { color: #1f5c49; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task.task-waiting-read {
  border-color: #d4a017;
  background: #fff8db;
}
.task.task-manager {
  border-color: #e65100;
  background: #fff3e0;
  color: #4a2c00;
}
.task.task-manager .when,
.task.task-manager .who-line { color: #8d3c00; }
.task.task-assignee-done {
  border-color: #43a047;
  background: #e8f5e9;
  color: #1b5e20;
}
.task.task-assignee-done .when,
.task.task-assignee-done .who-line { color: #2e7d32; }
.task.task-new {
  border-color: #2f6fd6;
  animation: task-new-blink 1s ease-in-out infinite;
}
.read-status {
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
}
.read-status-wait { color: #9a6700; }
.read-status-ok { color: var(--accent); }
@keyframes task-new-blink {
  0%, 100% { background: #e8f1ff; box-shadow: 0 0 0 1px #2f6fd6; }
  50% { background: #cfe0ff; box-shadow: 0 0 0 2px #1d4ed8; }
}
@media (prefers-reduced-motion: reduce) {
  .task.task-new { animation: none; background: #e8f1ff; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
a.chip, .chip {
  display: flex; flex-direction: column; gap: 1px;
  width: auto; max-width: 100%; margin: 0; padding: 8px 10px;
  border-radius: 10px; text-decoration: none; border: 1px solid;
  text-align: left; font: inherit; cursor: pointer;
}
.chip-name { cursor: default; background: #f4eee8; border-color: #c4b4a4; color: #4a3728; }
.chip-company { cursor: default; background: #eee8f4; border-color: #b4a4c4; color: #3a284a; }
.chip-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.chip-value { font-size: 14px; font-weight: 600; word-break: break-word; }
.chip-address-active { background: #fff3e0; border-color: #e65100; color: #bf360c; }
.chip-address-done { background: #e8f5e9; border-color: #43a047; color: #1b5e20; cursor: default; pointer-events: none; }
.chip-address-cancelled { background: #ffebee; border-color: #e53935; color: #b71c1c; cursor: default; pointer-events: none; }
.chip-address-cancelled .chip-note {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: #8b0000;
  margin-top: 4px;
  white-space: normal;
  word-break: break-word;
}
.chip-note { display: block; font-size: 0.78rem; font-weight: 600; opacity: 0.92; margin-top: 2px; }
.nav-cancel-box { margin-top: 4px; text-align: left; }
.nav-cancel-address {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.nav-cancel-reason {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  resize: vertical;
  min-height: 96px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text);
  background: #fff;
}
.chip-phone { background: #e8eef8; border-color: #8fa8d0; color: #1a3a6b; }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.when { font-size: 13px; color: var(--muted); }
.title { font-weight: 600; margin-top: 2px; }
.who-line { font-size: 13px; margin: 0; color: var(--muted); }
.who-author { align-self: flex-end; }
.who-assignee { margin-top: auto; padding-top: 6px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--accent); text-decoration: none; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photos img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; background: #ddd; }
.note { white-space: pre-wrap; }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; background: var(--header);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.bar a {
  flex: 1; text-align: center; color: #fff; text-decoration: none;
  padding: 10px 4px; font-size: 14px;
}
.install-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 12px 16px 0;
  padding: 14px 14px 10px;
}
.install-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.install-text { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.install-steps { margin: 0 0 8px; padding-left: 20px; color: var(--text); font-size: 14px; }
.install-steps li { margin: 4px 0; }
.install-later {
  width: auto; margin: 0; padding: 6px 0;
  border: 0; background: none; color: var(--muted); font-size: 13px;
}
.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.pwa-overlay-card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 16px 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
@media (min-width: 640px) {
  .pwa-overlay { align-items: center; }
}
@media (display-mode: standalone) {
  #pwa-install, #pwa-overlay { display: none !important; }
}
