:root {
  --ink: #082f63;
  --muted: #687789;
  --line: #d7e4eb;
  --panel: #ffffff;
  --page: #f4fafb;
  --accent: #05a99e;
  --accent-strong: #07346d;
  --warn: #b77900;
  --warn-dot: #f4b000;
  --warn-border: #f4b000;
  --warn-bg: #fff9e6;
  --danger: #c62828;
  --danger-border: #ef7770;
  --danger-bg: #fff1ed;
  --steady: #05a99e;
  --steady-bg: #eaf9f7;
  --good-bg: #e8f8f4;
  --shadow: 0 10px 30px rgba(8, 47, 99, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: grid;
  gap: 4px;
  align-items: start;
  justify-items: center;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: clamp(150px, 18vw, 230px);
  height: auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-lockup .eyebrow {
  margin-bottom: 0;
  color: var(--accent-strong);
  font-size: 0.9rem;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 48px) 44px;
}

.header-actions,
.dialog-actions,
.panel-toolbar,
.toolbar-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signed-in-user {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 92px);
  padding: 28px clamp(16px, 4vw, 48px);
}

.auth-screen[hidden],
main[hidden],
.text-button[hidden],
.file-button[hidden],
.signed-in-user[hidden],
#recordForm [hidden] {
  display: none;
}

.auth-panel {
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-brand {
  display: grid;
  gap: 8px;
}

.auth-logo {
  width: min(240px, 78%);
  height: auto;
}

.auth-copy {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.beta-note {
  margin: 0;
  border: 1px solid #f1d17a;
  border-radius: 8px;
  background: #fff9e6;
  color: #725500;
  padding: 9px 10px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.tester-brief {
  border: 1px solid #d6e7ec;
  border-radius: 8px;
  background: #f8fcfd;
  padding: 10px;
}

.tester-brief h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.95rem;
}

.tester-brief ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-error {
  margin: 0;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  font-weight: 750;
}

.icon-button,
.text-button,
.primary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.text-button {
  display: inline-grid;
  place-items: center;
  min-width: 76px;
  height: 42px;
  line-height: 1;
  padding: 0 14px;
}

.file-button {
  position: relative;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.ghost-button,
.danger-button {
  padding: 0 14px;
}

.text-link-button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0 4px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.danger-button {
  color: #a62929;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #cfe3ea;
}

.summary-band > div {
  min-height: 94px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfd 100%);
}

.summary-number {
  display: block;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  font-weight: 850;
}

.summary-label {
  color: var(--muted);
  font-weight: 650;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.sidebar,
.records-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  align-self: start;
}

label,
.filter-group p {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #173e68;
  font-size: 0.92rem;
  font-weight: 750;
}

.header-actions .file-button {
  display: inline-grid;
  place-items: center;
  margin-bottom: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbdde5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

input[readonly] {
  background: #f4f6f8;
  color: var(--muted);
}

textarea {
  resize: vertical;
}

.category-list {
  display: grid;
  gap: 12px;
}

.category-group-block {
  display: grid;
  gap: 7px;
}

.category-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 6px;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.category-group-title:hover {
  background: #eef8f8;
  color: var(--ink);
}

.category-group-title.active {
  background: var(--good-bg);
  color: var(--accent-strong);
}

.category-group-title > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.group-chevron {
  display: inline-grid;
  place-items: center;
  width: 16px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
}

.category-group-items {
  display: grid;
  gap: 6px;
}

.category-group-items[hidden] {
  display: none;
}

.category-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f4fafb;
  padding: 0 10px;
  color: #163a63;
  text-align: left;
}

.category-pill.active {
  border-color: var(--accent);
  background: var(--good-bg);
  color: var(--accent-strong);
}

.pill-count {
  color: var(--muted);
  font-size: 0.84rem;
}

.records-panel {
  min-width: 0;
  padding: 18px;
}

.panel-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.toggle-button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 800;
}

.toggle-button.active {
  background: var(--accent-strong);
  color: #fff;
}

.panel-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.records-grid.list-view {
  grid-template-columns: 1fr;
  gap: 8px;
}

.records-grid[hidden] {
  display: none;
}

.calendar-view {
  display: grid;
  gap: 10px;
}

.calendar-view[hidden] {
  display: none;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.calendar-toolbar h3 {
  margin: 0;
  font-size: 1.08rem;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.calendar-weekdays {
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.calendar-grid {
  border-radius: 0 0 8px 8px;
}

.calendar-weekdays span {
  min-height: 34px;
  background: #f7f8fa;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 850;
}

.calendar-cell {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 112px;
  background: #fff;
  padding: 8px;
}

.calendar-cell.muted {
  background: #f3f5f7;
}

.calendar-cell.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-day {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.calendar-items {
  display: grid;
  gap: 4px;
}

.calendar-item {
  width: 100%;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 6px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.15;
}

.calendar-item.steady,
.calendar-item.done {
  background: var(--steady-bg);
  color: var(--steady);
}

.calendar-item.warning {
  background: var(--warn-bg);
  color: var(--warn);
}

.calendar-item.urgent {
  background: var(--danger-bg);
  color: var(--danger);
}

.calendar-item span {
  display: block;
  overflow: hidden;
  white-space: normal;
  word-break: normal;
}

.calendar-empty {
  margin: 0;
  border: 1px dashed #c6ccd6;
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.record-card {
  display: grid;
  gap: 9px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.record-card:hover,
.record-card:focus-visible {
  box-shadow: 0 12px 28px rgba(28, 31, 39, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.record-card.steady {
  border-color: #b8d8ca;
  background: var(--steady-bg);
}

.record-card.steady .done-button {
  border-color: #b8d8ca;
}

.record-card.warning,
.record-card.soon {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.record-card.warning .done-button,
.record-card.soon .done-button {
  border-color: var(--warn-border);
}

.record-card.done {
  border-color: #d4dde5;
  background: #f4f6f8;
  color: #526170;
}

.record-card.done .done-button {
  border-color: #cfd8e0;
  background: #eef2f4;
  color: #657381;
}

.record-card.urgent,
.record-card.overdue {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.record-card.urgent .done-button,
.record-card.overdue .done-button {
  border-color: var(--danger-border);
}

.record-list-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.record-list-item:hover,
.record-list-item:focus-visible {
  box-shadow: 0 10px 22px rgba(8, 47, 99, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.record-list-item.steady {
  border-color: #b8d8ca;
}

.record-list-item.steady .list-done-button {
  border-color: #b8d8ca;
}

.record-list-item.warning,
.record-list-item.soon {
  border-color: var(--warn-border);
}

.record-list-item.warning .list-done-button,
.record-list-item.soon .list-done-button {
  border-color: var(--warn-border);
}

.record-list-item.urgent,
.record-list-item.overdue {
  border-color: var(--danger-border);
}

.record-list-item.urgent .list-done-button,
.record-list-item.overdue .list-done-button {
  border-color: var(--danger-border);
}

.record-list-item.done {
  border-color: #d4dde5;
  background: #f4f6f8;
}

.record-list-item.done .list-done-button {
  border-color: #cfd8e0;
  background: #eef2f4;
  color: #657381;
}

.list-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--steady);
}

.record-list-item.warning .list-status-dot,
.record-list-item.soon .list-status-dot {
  background: var(--warn-dot);
}

.record-list-item.urgent .list-status-dot,
.record-list-item.overdue .list-status-dot {
  background: var(--danger);
}

.record-list-item.done .list-status-dot {
  background: #8a96a3;
}

.list-main {
  min-width: 0;
}

.list-main h3 {
  margin: 0;
  color: #052b5f;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
}

.list-main p {
  margin: 3px 0 0;
  overflow: hidden;
  color: #667789;
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-status {
  color: #007f78;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.record-list-item.warning .list-status,
.record-list-item.soon .list-status {
  color: var(--warn-dot);
}

.record-list-item.urgent .list-status,
.record-list-item.overdue .list-status {
  color: var(--danger);
}

.record-list-item.done .list-status {
  color: #6f7c88;
}

.list-done-button {
  min-height: 34px;
  border: 1px solid #8fd5c8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 11px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.list-done-button:hover,
.list-done-button:focus-visible {
  background: var(--good-bg);
  outline: none;
}

.record-list-item.warning .list-done-button:hover,
.record-list-item.warning .list-done-button:focus-visible,
.record-list-item.soon .list-done-button:hover,
.record-list-item.soon .list-done-button:focus-visible {
  background: var(--warn-bg);
}

.record-list-item.urgent .list-done-button:hover,
.record-list-item.urgent .list-done-button:focus-visible,
.record-list-item.overdue .list-done-button:hover,
.record-list-item.overdue .list-done-button:focus-visible {
  background: var(--danger-bg);
}

.card-top,
.meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-identity {
  display: block;
  min-width: 0;
}

.card-category {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0 0;
  color: #007f78;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.16;
}

.category-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.category-svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-svg path,
.category-svg circle,
.category-svg rect {
  vector-effect: non-scaling-stroke;
}

.icon-home {
  color: #05a99e;
}

.icon-car,
.icon-mot {
  color: #07346d;
}

.icon-id-card {
  color: #07346d;
}

.icon-money {
  color: #058f85;
}

.icon-health {
  color: #b23d5a;
}

.icon-gift {
  color: #b35a7a;
}

.icon-pet {
  color: #8a4b9f;
}

.icon-gas {
  color: #05a99e;
}

.icon-electricity {
  color: #d99a00;
}

.icon-water {
  color: #0d7fb2;
}

.icon-electricity .icon-fill {
  fill: #ffd456;
}

.icon-water .icon-fill {
  fill: #bfe8ff;
}

.icon-tax {
  color: #5b6472;
}

.icon-self-assessment {
  color: #058f85;
}

.icon-phone,
.icon-wifi {
  color: #05a99e;
}

.icon-tv,
.icon-tv-licence {
  color: #7b4c2f;
}

.icon-service {
  color: #7a5a25;
}

.icon-other {
  color: #6b7c8f;
}

.record-card h3 {
  margin: 0;
  color: #052b5f;
  font-size: 1.2rem;
  font-weight: 950;
  line-height: 1.18;
}

.record-subtitle {
  margin: 4px 0 0;
  color: #667789;
  font-size: 0.92rem;
  font-weight: 650;
}

.renewal-badge {
  color: var(--warn-dot);
  font-size: 0.82rem;
  font-weight: 850;
}

.type-tag {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: #47627d;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 760;
  line-height: 1;
  max-width: max-content;
  white-space: nowrap;
}

.record-card.urgent .renewal-badge,
.record-card.overdue .renewal-badge {
  color: var(--danger);
}

.record-card.steady .renewal-badge {
  color: var(--steady);
}

.card-status-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(5, 169, 158, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 8px;
}

.record-card.warning .card-status-action {
  border-color: rgba(244, 176, 0, 0.38);
}

.record-card.urgent .card-status-action,
.record-card.overdue .card-status-action {
  border-color: rgba(198, 40, 40, 0.28);
}

.record-card.done .card-status-action {
  border-color: #d4dde5;
  background: rgba(255, 255, 255, 0.52);
}

.countdown-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(5, 169, 158, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 8px;
}

.due-date-main {
  display: grid;
  align-content: center;
  gap: 5px;
  flex: 1 1 120px;
  min-height: 58px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.due-date-label {
  color: #007f78;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.due-date-value {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 820;
  line-height: 1.2;
}

.due-date-extra {
  color: #667789;
  font-size: 0.82rem;
  font-weight: 720;
}

.record-card.warning .countdown-panel {
  border-color: rgba(244, 176, 0, 0.42);
}

.record-card.urgent .countdown-panel {
  border-color: rgba(198, 40, 40, 0.32);
}

.countdown-main {
  display: grid;
  place-items: center;
  flex: 0 0 76px;
  min-height: 58px;
  border-radius: 8px;
  background: #fff;
}

.countdown-number {
  color: var(--steady);
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.record-card.warning .countdown-number {
  color: var(--warn-dot);
}

.record-card.urgent .countdown-number {
  color: var(--danger);
}

.record-card.done .countdown-number {
  color: #6f7c88;
  font-size: 1.1rem;
}

.record-card.done .renewal-badge,
.record-card.done .due-date-label,
.record-card.done .countdown-unit,
.record-card.done .cost-snapshot-label {
  color: #6f7c88;
}

.record-card.done .card-category,
.record-card.done .type-tag {
  color: #526170;
}

.countdown-unit {
  color: #007f78;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
}

.smart-tip {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(7, 52, 109, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 8px 10px;
}

.smart-tip-label {
  color: #007f78;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.smart-tip-text {
  color: #123d69;
  font-size: 0.88rem;
  font-weight: 760;
  line-height: 1.35;
}

.cost-snapshot {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(47, 111, 146, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 10px;
}

.cost-snapshot-label {
  display: block;
  color: #007f78;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cost-snapshot-text {
  display: block;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 780;
  line-height: 1.35;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.meta-row dt {
  max-width: 48%;
  color: var(--muted);
  font-weight: 700;
}

.meta-row dd {
  margin: 0;
  max-width: 55%;
  text-align: right;
  word-break: break-word;
  font-weight: 750;
}

.notes {
  min-height: 42px;
  margin-bottom: 0;
  color: #4c515b;
  line-height: 1.45;
}

.document-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #4c515b;
  font-size: 0.9rem;
  font-weight: 750;
}

.document-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef2f4;
  color: var(--accent-strong);
}

.document-line span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  justify-content: flex-end;
  margin-top: auto;
}

.secondary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.done-button {
  min-height: 38px;
  border: 1px solid #8fd5c8;
  border-radius: 8px;
  background: #f5f9ff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 900;
  white-space: nowrap;
}

.done-button:hover,
.done-button:focus-visible {
  background: #eaf3ff;
  outline: none;
}

.record-card.warning .done-button:hover,
.record-card.warning .done-button:focus-visible,
.record-card.soon .done-button:hover,
.record-card.soon .done-button:focus-visible {
  background: #fff4cc;
}

.record-card.urgent .done-button:hover,
.record-card.urgent .done-button:focus-visible,
.record-card.overdue .done-button:hover,
.record-card.overdue .done-button:focus-visible {
  background: #ffe4de;
}

.done-button.is-done {
  border-color: #cfd8e0;
  background: #eef2f4;
  color: #657381;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed #c6ccd6;
  border-radius: 8px;
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(20, 25, 34, 0.24);
}

dialog::backdrop {
  background: rgba(20, 25, 34, 0.48);
}

#recordForm {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

#settingsForm {
  display: grid;
  gap: 0;
  background: #ffffff;
}

.info-dialog {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  background: #fff;
}

.info-dialog .dialog-header {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

#settingsForm .dialog-header {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

#settingsForm .dialog-header h2 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 900;
}

#settingsForm .icon-button {
  width: 36px;
  min-height: 36px;
  border-color: #cfe0e8;
  background: #f8fcfd;
  color: var(--ink);
  font-size: 1rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dialog-header h2 {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 14px;
}

#recordForm label {
  border-left: 3px solid rgba(5, 169, 158, 0.55);
  padding-left: 10px;
  color: #007f78;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

#recordForm input,
#recordForm select,
#recordForm textarea {
  border-color: #b8cbd8;
  background: #fbfeff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: none;
}

#recordForm input::placeholder,
#recordForm textarea::placeholder {
  color: #91a1b0;
  font-weight: 500;
}

.field-hint {
  color: #6f8193;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
}

#recordForm input:focus,
#recordForm select:focus,
#recordForm textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(5, 169, 158, 0.14);
  outline: none;
}

.website-link {
  display: inline-grid;
  place-items: center;
  justify-self: start;
  margin: -6px 0 10px;
  min-height: 38px;
  text-decoration: none;
}

.website-link[hidden] {
  display: none;
}

.settings-section {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: start;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 16px 18px;
  margin: 0;
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 900;
}

.settings-section p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.42;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.settings-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  min-width: 86px;
  height: 32px;
  min-height: 32px;
  justify-content: center;
  border-color: #cfe0e8;
  background: #f8fbfd;
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1;
}

.settings-actions .ghost-button:hover,
.settings-actions .ghost-button:focus-visible {
  border-color: var(--accent);
  background: #eef8f7;
  outline: none;
}

.settings-actions .compact-danger {
  display: inline-flex;
  align-items: center;
  min-width: 104px;
  height: 32px;
  min-height: 32px;
  justify-content: center;
  border-color: #f0c6c6;
  background: #fffafa;
  color: #a62929;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1;
}

.settings-fields {
  display: grid;
  gap: 10px;
  justify-self: stretch;
}

.settings-fields label {
  margin: 0;
  color: #173e68;
  font-size: 0.84rem;
  font-weight: 800;
}

.settings-fields select {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.settings-check input {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.info-content {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.info-content section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcfd;
  padding: 12px;
}

.info-content h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 0.98rem;
}

.info-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.feedback-field {
  margin: 0;
}

.feedback-field textarea {
  min-height: 150px;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cost-history-row label {
  border-left: 0;
  padding-left: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.cost-history {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 12px;
  margin-bottom: 14px;
}

.cost-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cost-history-header h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.cost-history-header p,
.cost-history-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.cost-history-list {
  display: grid;
  gap: 8px;
}

.cost-history-row {
  display: grid;
  grid-template-columns: 0.75fr 1fr 1fr minmax(140px, 1.4fr) auto;
  align-items: end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.cost-history-row label {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.cost-history-remove {
  min-height: 40px;
}

.dialog-actions {
  justify-content: space-between;
  margin-top: 8px;
}

@media (max-width: 820px) {
  main {
    display: flex;
    flex-direction: column;
  }

  .app-header,
  .panel-toolbar,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-lockup {
    gap: 8px;
  }

  .brand-logo {
    width: min(220px, 82vw);
  }

  .header-actions,
  .toolbar-actions,
  .dialog-actions > div {
    justify-content: flex-start;
  }

  .summary-band,
  .layout,
  .form-grid,
  .cost-history-row {
    grid-template-columns: 1fr;
  }

  .summary-band {
    display: none;
  }

  .layout {
    order: 1;
    margin-top: 0;
  }

  .records-panel {
    padding: 14px;
  }

  .records-panel .panel-toolbar {
    gap: 12px;
    margin-bottom: 12px;
  }

  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions .view-toggle {
    display: none;
  }

  #newRecordButton {
    width: 100%;
  }

  .cost-history-header {
    align-items: stretch;
    flex-direction: column;
  }

  .countdown-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .due-date-main {
    min-height: 64px;
  }

  .countdown-main {
    min-height: 72px;
    width: 100%;
  }

  .record-list-item {
    grid-template-columns: 12px minmax(0, 1fr) auto;
  }

  .list-status {
    grid-column: 2;
  }

  .list-done-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .card-status-action {
    align-items: stretch;
    flex-direction: column;
  }

  .card-status-action .done-button {
    width: 100%;
  }

  .settings-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .settings-actions {
    justify-content: flex-start;
  }

  .calendar-weekdays,
  .calendar-grid {
    min-width: 720px;
  }

  .calendar-view {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sidebar {
    display: none;
  }
}
