:root {
  --ink: #19322d;
  --ink-soft: #5b706a;
  --paper: #f6f6f0;
  --card: #fffefa;
  --line: #dfe5dc;
  --green: #1f5d50;
  --green-dark: #16463c;
  --green-pale: #d9ece0;
  --blue: #3269ad;
  --blue-pale: #dceafa;
  --yellow: #8a6800;
  --yellow-pale: #fff1bd;
  --red: #a64336;
  --red-pale: #f8ded8;
  --shadow: 0 12px 35px rgba(25, 50, 45, .1);
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); }
body.modal-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, .progress-value, .login-card h1, .section-header h2 { font-family: Georgia, "Times New Roman", serif; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-soft); line-height: 1.5; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 0%, #dcefe0, transparent 33rem), var(--paper); }
.login-card { width: min(100%, 440px); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.login-card h1 { margin: 34px 0 10px; font-size: 2.2rem; letter-spacing: -.04em; }
.loading-card { display: grid; gap: 28px; }
.loading-card p { margin: 0; }
.login-form { display: grid; gap: 14px; margin-top: 25px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--green); font-size: 1.15rem; font-weight: 800; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: white; background: var(--green); }
.demo-note { margin: 17px 0 0; padding: 12px; border-radius: 10px; color: var(--green-dark); background: #edf5ee; font-size: .82rem; line-height: 1.45; }
.form-error { margin: 0; color: var(--red); font-size: .84rem; font-weight: 750; }

label { display: grid; gap: 7px; color: var(--ink-soft); font-size: .88rem; font-weight: 650; }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #cbd7cf; border-radius: 10px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
select[multiple] { min-height: 118px; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid #b9ddca; outline-offset: 2px; border-color: var(--green); }
label small, .form-hint { margin: 0; color: var(--ink-soft); font-size: .72rem; line-height: 1.4; font-weight: 500; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 10px 15px; border: 1px solid transparent; border-radius: 10px; font-weight: 750; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--green); border-color: #b9cec0; background: var(--card); }
.button-secondary:hover { background: #edf5ee; }
.button-plain { color: var(--ink-soft); background: transparent; }
.button-plain:hover { background: #edf0eb; }
.button-danger { color: var(--red); border-color: #e4b9b1; background: #fff; }
.button-danger:hover { background: var(--red-pale); }
.compact-action { white-space: nowrap; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 23px 16px; border-right: 1px solid var(--line); background: #f1f3eb; display: flex; flex-direction: column; }
.sidebar .brand { padding: 0 10px; }
.nav { display: grid; gap: 4px; margin-top: 41px; }
.nav-button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 11px 12px; border: 0; border-radius: 10px; color: var(--ink-soft); background: transparent; text-align: left; font-weight: 650; }
.nav-button:hover { color: var(--ink); background: #e6ebe4; }
.nav-button.active { color: #fff; background: var(--green); }
.nav-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; background: rgba(31, 93, 80, .08); }
.nav-icon::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; }
.nav-icon-overview::before { -webkit-mask-image: url('/icons/ui/layout-dashboard.svg'); mask-image: url('/icons/ui/layout-dashboard.svg'); }
.nav-icon-timeline::before { -webkit-mask-image: url('/icons/ui/list-todo.svg'); mask-image: url('/icons/ui/list-todo.svg'); }
.nav-icon-settings::before { -webkit-mask-image: url('/icons/ui/settings.svg'); mask-image: url('/icons/ui/settings.svg'); }
.nav-button.active .nav-icon { background: rgba(255, 255, 255, .16); }
.user-mini { margin-top: auto; padding: 14px 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #6c987e; font-size: .76rem; font-weight: 800; }
.user-name { font-size: .86rem; font-weight: 750; }
.user-role { color: var(--ink-soft); font-size: .72rem; }

.content { width: 100%; max-width: 1400px; margin: 0 auto; padding: 28px 34px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.55rem); letter-spacing: -.045em; }
.eyebrow { margin: 0 0 4px; overflow: hidden; color: var(--ink-soft); font-size: .78rem; font-weight: 750; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.actions { display: flex; align-items: center; gap: 9px; }
.event-select { width: auto; max-width: 260px; color: var(--ink); background: var(--card); font-weight: 650; }

.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 2px 4px rgba(25, 50, 45, .02); }
.panel-pad { padding: 21px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-heading > div { min-width: 0; }
.panel-heading h2 { margin: 0; font-size: 1.04rem; letter-spacing: -.015em; }
.panel-heading p { margin: 4px 0 0; color: var(--ink-soft); font-size: .83rem; line-height: 1.4; }
.overview-grid { display: grid; grid-template-columns: 1.55fr .85fr; gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 18px; border-radius: 13px; background: var(--blue-pale); }
.stat:nth-child(2) { background: var(--yellow-pale); }
.stat:nth-child(3) { background: var(--red-pale); }
.stat-value { display: block; font-family: Georgia, serif; font-size: 2.05rem; line-height: 1; letter-spacing: -.06em; }
.stat-label { display: block; margin-top: 7px; color: var(--ink-soft); font-size: .79rem; font-weight: 650; }
.section { margin-top: 24px; }
.heading-note { color: var(--ink-soft); font-size: .78rem; font-weight: 400; }
.progress-big { color: #fff; background: linear-gradient(135deg, var(--green), #397a66); }
.progress-big .panel-heading h2, .progress-big .panel-heading p { color: #fff; }
.progress-big .panel-heading p { opacity: .78; }
.progress-value { display: flex; align-items: baseline; gap: 7px; font-size: 3.2rem; letter-spacing: -.06em; }
.progress-value span { font-family: inherit; font-size: .8rem; letter-spacing: 0; opacity: .82; }
.progress-track, .tiny-progress { overflow: hidden; border-radius: 10px; }
.progress-track { height: 9px; margin: 16px 0 9px; background: rgba(255,255,255,.25); }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: #f1d995; }
.progress-caption { margin: 0; font-size: .79rem; opacity: .88; }

.deadline-list { display: grid; gap: 3px; }
.deadline-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: center; width: 100%; min-height: 58px; padding: 8px 0; border: 0; border-bottom: 1px solid #edf0eb; color: var(--ink); background: transparent; text-align: left; }
.deadline-item:last-child { border-bottom: 0; }
.date-chip { width: 42px; padding: 6px 2px; border-radius: 9px; color: var(--blue); background: var(--blue-pale); text-align: center; font-size: .66rem; font-weight: 800; line-height: 1.05; }
.date-chip b { display: block; font-size: .98rem; }
.date-chip.in-progress { color: var(--yellow); background: var(--yellow-pale); }
.date-chip.done { color: #39715b; background: #e5f1e8; }
.date-chip.overdue { color: var(--red); background: var(--red-pale); }
.deadline-title { display: block; font-size: .88rem; font-weight: 750; }
.deadline-meta { display: block; margin-top: 2px; overflow: hidden; color: var(--ink-soft); font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.deadline-state { font-size: .7rem; font-weight: 750; }
.deadline-state.open { color: var(--blue); }
.deadline-state.in-progress { color: var(--yellow); }
.deadline-state.done { color: #39715b; }
.deadline-alert { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: var(--red); font-size: .78rem; font-weight: 850; }

.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-header h2 { margin: 0; font-size: 1.42rem; letter-spacing: -.035em; }
.group-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.group-card { position: relative; overflow: hidden; padding: 18px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--card); text-align: left; transition: transform .18s, box-shadow .18s; }
.group-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.group-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--card-color, var(--green)); }
.group-name { margin: 7px 0 15px; font-size: 1rem; }
.group-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: .76rem; }
.group-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiny-progress { height: 6px; margin: 10px 0; background: #e8ede8; }
.tiny-progress span { display: block; height: 100%; border-radius: inherit; background: var(--card-color, var(--green)); }

.timeline-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin: -10px 0 18px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { min-height: 36px; padding: 7px 11px; border: 1px solid #cbd7cf; border-radius: 20px; color: var(--ink-soft); background: var(--card); font-size: .78rem; font-weight: 750; }
.filter.active { color: #fff; border-color: var(--green); background: var(--green); }
.task-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.timeline-task-card { display: flex; flex-direction: column; gap: 5px; width: 100%; min-width: 0; min-height: 145px; padding: 12px; border: 1px solid #d4dfeb; border-left: 4px solid var(--blue); border-radius: 12px; color: var(--ink); background: var(--card); text-align: left; box-shadow: 0 2px 4px rgba(25, 50, 45, .025); }
.timeline-task-card.in-progress { border-color: #eadba5; border-left-color: var(--yellow); }
.timeline-task-card.done { border-color: #cfe1d5; border-left-color: #39715b; }
.timeline-task-card.overdue { border-color: #ebc5be; border-left-color: var(--red); }
.timeline-task-card:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(25, 50, 45, .08); }
.timeline-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.timeline-card-head .date-chip { flex: 0 0 auto; }
.timeline-task-title { display: -webkit-box; overflow: hidden; min-height: 2.6em; font-size: .84rem; font-weight: 800; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.timeline-task-meta { overflow: hidden; color: var(--ink-soft); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.status-label { flex: 0 0 auto; padding: 3px 7px; border-radius: 10px; color: var(--blue); background: var(--blue-pale); font-size: .62rem; font-weight: 800; white-space: nowrap; }
.in-progress .status-label { color: var(--yellow); background: var(--yellow-pale); }
.done .status-label { color: #39715b; background: #e5f1e8; }
.overdue .status-label { color: var(--red); background: var(--red-pale); }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 22px; background: rgba(16, 36, 31, .5); }
.modal { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(100%, 620px); max-height: min(760px, calc(100dvh - 44px)); overflow: hidden; border-radius: 20px; background: var(--card); box-shadow: 0 18px 55px rgba(0,0,0,.22); }
.modal-wide { width: min(100%, 720px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 22px 24px 14px; }
.modal-header h2 { margin: 0 0 4px; font-family: Georgia, serif; font-size: 1.45rem; letter-spacing: -.025em; }
.modal-header p { margin: 0; font-size: .8rem; }
.modal-body { min-height: 0; overflow-y: auto; padding: 8px 24px 20px; }
.close { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border: 0; border-radius: 50%; color: var(--ink-soft); background: #eef1ec; font-size: 1.25rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px 18px; border-top: 1px solid var(--line); background: var(--card); }
.form-actions .button-danger, .logout-button { margin-right: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-grid legend { margin-bottom: 7px; color: var(--ink-soft); font-size: .88rem; font-weight: 650; }
.task-detail-description { margin: 4px 0 20px; color: var(--ink-soft); line-height: 1.55; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-field { padding: 12px; border-radius: 10px; background: #f3f5f1; }
.detail-field span { display: block; color: var(--ink-soft); font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.detail-field b { display: block; margin-top: 4px; font-size: .84rem; }
.status-control { margin-top: 14px; }
.checklist { margin: 22px 0; }
.checklist h3, .comments h3, .settings-section h3 { margin-bottom: 10px; font-size: .92rem; }
.check-item { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf0eb; color: var(--ink-soft); font-size: .84rem; }
.check-item input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--green); }
.check-item.done { color: #75837e; text-decoration: line-through; }
.comment { padding: 11px 0; border-bottom: 1px solid #edf0eb; font-size: .84rem; line-height: 1.45; }
.comment b { display: block; margin-bottom: 2px; }
.comment time { color: var(--ink-soft); font-size: .7rem; }
.comment-text { white-space: pre-wrap; }
.comment-attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.comment-attachment { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #f7f8f5; text-decoration: none; }
.comment-attachment:hover { border-color: #a9c4b3; background: #edf5ee; }
.comment-attachment img { width: 58px; height: 46px; flex: 0 0 auto; border-radius: 7px; object-fit: cover; background: #e8ece7; }
.attachment-icon { display: grid; place-items: center; width: 42px; height: 46px; flex: 0 0 auto; border-radius: 7px; color: var(--red); background: var(--red-pale); font-size: .67rem; font-weight: 850; }
.attachment-meta { min-width: 0; }
.attachment-meta b { overflow: hidden; margin: 0; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .67rem; }
.comment-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; min-width: 0; margin-top: 12px; }
.comment-form > * { width: auto; min-width: 0; max-width: 100%; }
.comment-form > input, .comment-form > .button { width: 100%; }
.attachment-field { display: flex; align-items: center; gap: 7px; overflow: hidden; padding: 9px 11px; border: 1px dashed #b9c8bf; border-radius: 10px; background: #f7f8f5; font-size: .76rem; }
.attachment-field span { margin-right: auto; color: var(--ink-soft); font-size: .68rem; font-weight: 500; }
.attachment-field input { width: auto; min-width: 0; max-width: 230px; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: .68rem; }
.attachment-field input::file-selector-button { margin-right: 8px; padding: 7px 9px; border: 1px solid #b9cec0; border-radius: 8px; color: var(--green); background: #fff; font-weight: 750; }
.permission-note { padding: 10px; border-radius: 9px; color: var(--ink-soft); background: #f0f2ee; font-size: .76rem; }
.management-link { margin-bottom: 18px; }
.settings-section p { margin: 0 0 12px; color: var(--ink-soft); font-size: .8rem; line-height: 1.45; }
.settings-section + .settings-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.password-form { display: grid; gap: 11px; }

.management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.management-users { grid-column: 1 / -1; }
.management-list { display: grid; gap: 9px; }
.user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.management-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; }
.management-row.selected { border-color: var(--green); background: #edf5ee; }
.row-main { min-width: 0; flex: 1; border: 0; color: var(--ink); background: transparent; text-align: left; }
.row-main b { display: block; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { display: block; margin-top: 3px; overflow: hidden; color: var(--ink-soft); font-size: .72rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.row-count { color: var(--ink-soft); font-size: .7rem; font-weight: 700; }
.management-edit { min-height: 34px; padding: 6px 9px; font-size: .7rem; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--green); background: #fff; font-weight: 800; }
.danger-icon { color: var(--red); }
.group-toggle { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: .68rem; font-weight: 700; }
.group-toggle input { width: 18px; height: 18px; accent-color: var(--green); }
.role-badge { display: inline-block; padding: 2px 6px; border-radius: 8px; color: #39715b; background: #e5f1e8; font-weight: 800; }
.role-badge.admin { color: var(--green); background: var(--green-pale); }
.member-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.member-picker label { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: .8rem; }
.member-picker input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--green); }
.member-picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-picker small { margin-left: auto; font-size: .63rem; font-weight: 700; }
.empty, .empty-state { padding: 30px; color: var(--ink-soft); text-align: center; }
.empty-state { margin: 10vh auto; }
.toast { position: fixed; z-index: 30; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 11px; color: #fff; background: var(--green-dark); box-shadow: var(--shadow); font-size: .84rem; font-weight: 750; }

@media (max-width: 1000px) {
  .overview-grid { grid-template-columns: 1fr; }
  .group-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .management-grid { grid-template-columns: 1fr; }
  .management-users { grid-column: auto; }
  .user-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1250px) and (min-width: 1001px) {
  .task-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

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

@media (max-width: 850px) {
  .app-shell { display: block; padding-bottom: 72px; }
  .sidebar { position: fixed; z-index: 10; inset: auto 0 0; width: 100%; height: 64px; padding: 6px 8px; border: 0; border-top: 1px solid var(--line); display: block; background: #fffefa; }
  .sidebar .brand, .user-mini { display: none; }
  .nav { grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0; }
  .nav-button { height: 51px; padding: 4px; flex-direction: column; justify-content: center; gap: 2px; font-size: .66rem; }
  .nav-icon { width: 22px; height: 22px; flex-basis: 22px; }
  .nav-icon::before { width: 15px; height: 15px; }
  .content { padding: 18px 16px 34px; }
  .topbar { align-items: flex-start; margin-bottom: 21px; }
  .topbar h1 { font-size: 1.8rem; }
  .actions { flex-wrap: wrap; justify-content: flex-end; }
  .event-select { order: 2; width: 100%; max-width: 180px; min-height: 38px; padding: 8px 10px; font-size: .76rem; }
  .task-action { min-width: 44px; min-height: 44px; padding: 9px 11px; }
  .task-action span:last-child { display: none; }
  .stats { gap: 8px; }
  .stat { padding: 13px 10px; }
  .stat-value { font-size: 1.6rem; }
  .stat-label { font-size: .68rem; }
  .group-list { grid-template-columns: 1fr; }
  .timeline-toolbar { align-items: flex-start; flex-direction: column; }
  .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-task-card { min-height: 140px; }
  .modal-backdrop { place-items: end center; padding: 12px 0 0; }
  .modal, .modal-wide { width: 100%; max-height: calc(100dvh - 12px); border-radius: 20px 20px 0 0; }
  .modal-header { padding: 18px 16px 12px; }
  .modal-body { padding: 6px 16px 18px; }
  .form-actions { padding: 12px 16px max(14px, env(safe-area-inset-bottom)); }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .member-picker { grid-template-columns: 1fr; }
  .comment-form { align-items: stretch; }
  .comment-attachments { grid-template-columns: 1fr; }
  .comment-form { grid-template-columns: 1fr; }
  .comment-form .button { width: 100%; }
  .attachment-field { grid-column: auto; align-items: flex-start; flex-direction: column; }
  .attachment-field input { width: 100%; max-width: none; }
  .panel-heading { align-items: flex-start; }
  .compact-action { min-width: 42px; padding-inline: 10px; font-size: .72rem; }
  .management-row { align-items: flex-start; }
  .row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .row-count { display: none; }
  .group-toggle span { display: none; }
  .toast { right: 16px; bottom: 78px; }
}

@media (max-width: 430px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(112px, 150px); gap: 12px; }
  .actions { display: flex; flex-wrap: nowrap; gap: 8px; width: 100%; min-width: 0; }
  .event-select { order: initial; width: 100%; max-width: none; min-width: 0; }
  .task-action { flex: 0 0 44px; }
  .panel-pad { padding: 16px; }
  .compact-action { flex: 0 0 auto; max-width: 46%; }
  .deadline-state { display: none; }
  .deadline-item { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .button { flex: 1 1 auto; }
  .form-actions .button-danger, .form-actions .logout-button { margin-right: 0; }
}

@media (max-width: 600px) {
  .task-grid { grid-template-columns: 1fr; }
  .timeline-task-card { min-height: 0; }
  .timeline-task-title { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
