/* Panel - baza: layout, menu, formularze */

:root {
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --orange: #ff9f1c;
  --purple: #7b5bd6;
  --red: #dc2626;
  --radius: 18px;
  --shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
  /* Kolory marki: --brand-*, --bg, --line, --dark - ustawiane w brand-theme.php */
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  max-width: 100%;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand-primary-light) 20%, transparent), transparent 35%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand-primary-light) 8%, #fff), var(--bg));
  color: var(--text);
  font-family: "Plus Jakarta Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

.form-select,
.form-panel select,
.form-grid select {
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--panel);
  color: var(--text);
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 2px),
    calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.form-select:focus,
.form-panel select:focus,
.form-grid select:focus {
  outline: 2px solid color-mix(in srgb, var(--blue) 35%, transparent);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
}

button {
  cursor: pointer;
  border: 0;
  font: inherit;
}

.hidden {
  display: none !important;
}

.preview-feature-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.28);
  vertical-align: middle;
}

h1 {
  margin: 0 0 24px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0;
  font-size: 19px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  align-items: start;
}

.main {
  min-width: 0;
  align-self: start;
  width: 100%;
}

.content {
  width: 100%;
  max-width: none;
  padding: 28px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  max-height: 100vh;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg-bottom) 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 28px;
}

.logo-box-link {
  color: inherit;
  text-decoration: none;
  border-radius: 14px;
  transition: background 0.15s ease;
}

.logo-box-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.logo-box img {
  width: 54px;
  height: 54px;
  /* Sidebar ma ciemne tło w obu motywach - logo SVG (czarne) musi być jasne */
  filter: brightness(0) invert(1) opacity(0.92);
}

.logo-box strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.logo-box span {
  display: block;
  margin-top: 6px;
  color: color-mix(in srgb, var(--brand-primary-light) 72%, #fff);
  font-size: 14px;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.nav-icon-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.nav-icon:not([data-fallback="1"]) .nav-icon-fallback {
  display: none;
}

.nav-icon[data-fallback="1"] .nav-icon-img {
  display: none;
}

.sidebar .nav-icon-img,
.bottom-nav .nav-icon-img,
.bottom-more-menu .nav-icon-img {
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.logout-form {
  width: 100%;
  margin-top: auto;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 16px;
}

.sidebar-pro-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-pro-crown {
  font-size: 1.15rem;
  line-height: 1;
}

.sidebar-pro-card strong {
  font-size: 0.98rem;
}

.sidebar-pro-card > span:not(.sidebar-pro-crown):not(.sidebar-pro-btn) {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  line-height: 1.4;
}

.sidebar-pro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.28);
}

.sidebar-plan-mini-link {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-plan-mini-link strong {
  font-size: 0.9rem;
}

.sidebar-plan-mini-link span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
}

.sidebar-plan-expiry-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(234, 88, 12, 0.14);
  border: 1px solid rgba(251, 146, 60, 0.45);
  color: #fff;
  text-decoration: none;
}

.sidebar-expiry-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.sidebar-plan-expiry-card strong {
  font-size: 0.98rem;
  color: #fdba74;
}

.sidebar-plan-expiry-card > span:not(.sidebar-expiry-icon):not(.sidebar-expiry-btn) {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.82rem;
  line-height: 1.45;
}

.sidebar-expiry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.28);
}

.sidebar-plan-expiry-card:hover {
  background: rgba(234, 88, 12, 0.2);
  border-color: rgba(251, 146, 60, 0.62);
}

.sidebar-help-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.sidebar-help-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-help-text strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.sidebar-help-text small {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 400;
}

.sidebar-help-chevron {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.72;
}

.sidebar-help-link:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
}

.side-nav a,
.logout-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 12px;
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.95rem;
  transition: 0.18s ease;
}

.side-nav a span:not(.nav-icon) {
  width: 24px;
  text-align: center;
  font-size: 20px;
}

.side-nav a span.nav-icon {
  width: 36px;
  flex-shrink: 0;
}

.side-nav a .preview-feature-mark,
.side-nav .nav-disabled .preview-feature-mark,
.bottom-more-menu a .preview-feature-mark,
.bottom-more-menu .nav-disabled .preview-feature-mark {
  width: 18px;
  height: 18px;
  margin-left: auto;
  font-size: 11px;
}

.side-nav a:hover,
.side-nav a.active {
  background: linear-gradient(135deg, var(--sidebar-active-start, var(--brand-primary-dark)), var(--sidebar-active-end, var(--brand-primary-deep)));
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.side-nav a.side-nav-public {
  margin-top: 8px;
  opacity: 0.92;
}

.logout-link {
  margin-top: auto;
}

.logout-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 82px 1fr;
}

body.sidebar-collapsed .sidebar {
  width: 82px;
  padding-left: 10px;
  padding-right: 10px;
}

body.sidebar-collapsed .logo-box {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .logo-box div {
  display: none;
}

body.sidebar-collapsed .side-nav a,
body.sidebar-collapsed .logout-link {
  justify-content: center;
  gap: 0;
  padding: 0;
  font-size: 0;
  overflow: hidden;
  position: relative;
}

body.sidebar-collapsed .side-nav a span:not(.nav-icon):not(.preview-feature-mark) {
  width: auto;
  font-size: 20px;
}

body.sidebar-collapsed .side-nav a .preview-feature-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  margin: 0;
  font-size: 9px;
  z-index: 1;
}

body.sidebar-collapsed .side-nav a span.nav-icon {
  width: 36px;
  height: 36px;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.sidebar-collapsed .side-nav a span.nav-icon .nav-icon-fallback {
  font-size: 20px;
}

body.sidebar-collapsed .side-nav a,
body.sidebar-collapsed .side-nav .nav-disabled {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
  gap: 0;
  padding: 0;
  font-size: 0;
  overflow: hidden;
}

body.sidebar-collapsed .side-nav .nav-disabled span.nav-icon {
  width: 36px;
  height: 36px;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.sidebar-collapsed .logout-link::first-letter {
  font-size: 18px;
}

body.sidebar-collapsed .sidebar-footer {
  gap: 8px;
}

body.sidebar-collapsed .sidebar-pro-card {
  display: grid;
  place-items: center;
  padding: 10px 8px;
  min-height: 44px;
  text-align: center;
}

body.sidebar-collapsed .sidebar-pro-text,
body.sidebar-collapsed .sidebar-pro-btn {
  display: none;
}

body.sidebar-collapsed .sidebar-pro-crown {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
}

body.sidebar-collapsed .sidebar-plan-expiry-card,
body.sidebar-collapsed .sidebar-plan-mini-link {
  display: grid;
  place-items: center;
  padding: 10px 8px;
  min-height: 44px;
  text-align: center;
}

body.sidebar-collapsed .sidebar-plan-mini-link span {
  display: none;
}

body.sidebar-collapsed .sidebar-expiry-text,
body.sidebar-collapsed .sidebar-expiry-btn {
  display: none;
}

body.sidebar-collapsed .sidebar-expiry-icon {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
}

body.sidebar-collapsed .sidebar-help-link {
  justify-content: center;
  padding: 10px 8px;
  min-height: 44px;
}

body.sidebar-collapsed .sidebar-help-text,
body.sidebar-collapsed .sidebar-help-chevron {
  display: none;
}

body.sidebar-collapsed .sidebar-help-icon {
  display: inline;
  font-size: 1.2rem;
  line-height: 1;
}

.sidebar-help-icon {
  display: none;
}

.app-busy-progress {
  width: min(220px, 72vw);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue, #2563eb) 16%, var(--line));
}

.app-busy-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--blue, #2563eb);
  transition: width 0.2s ease;
}

.app-busy-spinner em {
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  height: auto;
  min-height: 72px;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.menu-button {
  border: 0;
  background: transparent;
  color: var(--dark);
  font-size: 28px;
  box-shadow: none;
}

.user-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  min-width: 0;
  flex-shrink: 0;
}

.user-menu {
  position: relative;
  flex-shrink: 0;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.user-menu-head {
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  line-height: 1.3;
}

.user-menu-head strong {
  display: block;
}

.user-menu-panel a,
.user-menu-panel button,
.user-menu-logout button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.user-menu-soon {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font: inherit;
  cursor: not-allowed;
  opacity: 0.72;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover,
.user-menu-logout button:hover {
  background: #f1f5f9;
}

.user-menu-logout {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 4px;
  margin-top: 4px;
}

.user-greeting-short {
  display: none;
}

.user-avatar {
  font-size: 22px;
  flex-shrink: 0;
}

.user-box span.user-avatar {
  font-size: 22px;
}

.action-button,
.small-button {
  min-width: 92px;
  height: 42px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--brand-shadow);
}

.action-button:hover,
.small-button:hover {
  filter: brightness(0.96);
}

.action-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.action-button:disabled:hover {
  filter: none;
}

/* Drugorzędny przycisk - pełne style jako klasa standalone */
.secondary-button {
  min-width: 92px;
  height: 42px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
  border: none;
  cursor: pointer;
}
.secondary-button:hover {
  filter: brightness(0.96);
}
/* Alias: action-button secondary = secondary-button action-button */
.action-button.secondary {
  box-shadow: none;
  border: none;
}

.danger {
  min-width: 92px;
  height: 42px;
  padding: 10px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

.danger:hover {
  filter: brightness(0.97);
}

.small {
  padding: 10px 12px;
  font-size: 13px;
}

.panel {
  margin-bottom: 20px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin-right: auto;
}

.stat-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 26px;
  flex: 0 0 auto;
}

.money-totals {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.2;
}

.money-totals-main {
  display: block;
  white-space: nowrap;
}

.money-totals-amount {
  white-space: nowrap;
}

.money-totals-extra {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
}

.money-totals-more {
  margin-top: 2px;
}

.money-totals-more summary {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.money-totals-more summary::-webkit-details-marker {
  display: none;
}

.money-totals-more[open] summary {
  margin-bottom: 4px;
}

.money-totals-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 18px;
}

.form-panel {
  margin-bottom: 24px;
}

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

.form-grid > label,
.form-grid > .form-field-rich {
  position: relative;
  padding-bottom: 1.35rem;
}

.form-grid > .form-field-rich {
  display: grid;
  gap: 8px;
}

.form-grid > .form-field-rich > .field-label {
  display: block;
  line-height: 1.35;
  font-weight: 600;
}

.form-grid > label .field-label {
  display: block;
  line-height: 1.35;
}

.label-hint {
  font-weight: 500;
  font-size: 0.88em;
  color: var(--muted);
}

.form-grid > label .field-counter {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 0;
}

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

.form-grid-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--brand-primary-light) 55%, #fff);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.list-item {
  display: grid;
  grid-template-columns: 118px 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item time {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.item-main strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.item-main p,
.expense-item p {
  margin: 0 0 8px;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-main small,
.item-main a {
  color: var(--muted);
  font-size: 14px;
}

.thumb {
  width: 118px;
  height: 94px;
  border-radius: 8px;
  object-fit: cover;
  background: #dbeafe;
}

.generated-thumb {
  background:
    linear-gradient(135deg, rgba(7, 24, 39, 0.15), rgba(255, 159, 28, 0.25)),
    url("icon.svg") center / 56px no-repeat,
    #e8eef6;
}

.expense-items-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fbff;
}

.expense-items-box > label {
  margin-bottom: 10px;
}

[data-expense-items] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expense-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 68px 92px 58px;
  gap: 6px;
  align-items: center;
}

.expense-item-row input {
  width: 100%;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 12px;
  box-sizing: border-box;
}

.expense-item-row input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.expense-item-row input[type="number"]::-webkit-outer-spin-button,
.expense-item-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.expense-item-row .js-remove-expense-item {
  width: 100%;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 10px;
  box-sizing: border-box;
  box-shadow: none;
}

.expense-items-box .small-button {
  width: 100%;
  margin-top: 8px;
}

.expense-items-box [data-add-expense-item] {
  margin-top: 18px;
}

.expense-submit-row {
  margin-top: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.mini-card {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mini-card h2 {
  margin: 12px 0 8px;
}

.mini-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d5dad;
  font-size: 12px;
  font-weight: 800;
}

.badge-action {
  background: #fff3e6;
  color: #b45309;
  border: 1px solid #fdba74;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: none;
}

.status-dot {
  display: inline-flex;
  width: 10px;
  height: 10px;
  margin-left: 10px;
  margin-right: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
}

.status-dot.green {
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.debug-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.12);
}

.debug-badge:hover {
  opacity: 0.95;
}

.topbar .user-box .debug-badge {
  background: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.12) !important;
}

.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;
}

#entryModal:not(.hidden),
#journalPhotosModal:not(.hidden),
#confirmModal:not(.hidden),
#panelSearchModal:not(.hidden) {
  z-index: 3000;
}

#attachmentDeleteModal:not(.hidden) {
  z-index: 3100;
}

#entryModalContent {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.muted {
  color: var(--muted);
}

.form-panel > button,
.form-panel .action-button,
.form-panel .small-button {
  margin-top: 12px;
}

.form-panel .expense-item-row .js-remove-expense-item {
  margin: 0;
}

.form-panel [data-add-expense-item] {
  margin-top: 18px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--brand-surface-muted);
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

@keyframes toast-progress-shrink {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

.is-busy-host {
  pointer-events: none;
}

@keyframes app-busy-spin {
  to {
    transform: rotate(360deg);
  }
}

.maintenance-page {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.10), transparent 35%),
    linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
}

.maintenance-card {
  width: min(640px, 100%);
  padding: 28px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.07);
  text-align: center;
}

.maintenance-card h1 {
  margin-bottom: 12px;
}

.maintenance-card p {
  margin: 0 0 12px;
}

.maintenance-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin-bottom: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 13px;
  font-weight: 800;
}

.maintenance-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.maintenance-banner {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid rgba(249, 115, 22, 0.18);
}

.maintenance-banner strong {
  display: block;
  margin-bottom: 4px;
  color: #7c2d12;
}

@media (max-width: 640px) {

  .maintenance-card {
    padding: 22px 18px;
    border-radius: 20px;
  }
}

@media (max-width: 640px) {
  .confirm-modal-box {
    padding: 22px 18px;
  }

  .confirm-modal-actions {
    flex-direction: column-reverse;
  }

  .confirm-modal-actions .action-button,
  .confirm-modal-actions .secondary,
  .confirm-modal-actions .danger {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--panel);
    color: var(--text);
    border-bottom: 1px solid var(--line);
  }

  .menu-button {
    color: var(--text);
    flex-shrink: 0;
  }

  .topbar-project-trigger .topbar-project-name {
    color: var(--text);
    font-size: 13px;
  }

  .topbar-project-progress-meta {
    color: var(--muted);
  }

  .topbar-right {
    margin-left: auto;
    flex-shrink: 1;
    min-width: 0;
    gap: 8px;
  }

  .topbar-notifications {
    gap: 6px;
  }

  .topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .user-box {
    font-size: 12px;
    gap: 6px;
    max-width: 46%;
  }

  .user-menu-trigger {
    max-width: min(100%, 220px);
    gap: 6px;
    padding: 0 10px 0 8px;
  }

  .user-menu-trigger .plan-badge {
    font-size: 9px;
    padding: 2px 6px;
    margin-right: 0;
  }

  .user-greeting-full {
    display: none;
  }

  .user-greeting-short {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 88px;
  }

  .user-avatar {
    font-size: 18px;
  }

  .content {
    padding: 16px;
  }

  h1 {
    margin-bottom: 16px;
    font-size: 24px;
  }

  .form-panel,
  .panel {
    overflow: visible;
  }

  .content,
  .main,
  .app-shell {
    overflow-x: clip;
    max-width: 100%;
    min-width: 0;
  }

  .projects-hub,
  .projects-hub-head,
  .projects-hub-actions,
  .projects-cards-grid,
  .projects-toolbar,
  .projects-toolbar-controls,
  .projects-filter-tabs,
  .projects-stat-card {
    min-width: 0;
    max-width: 100%;
  }

  .projects-hub-actions {
    flex-wrap: wrap;
    flex-direction: column;
    width: 100%;
  }

  .projects-toolbar-select {
    width: 100%;
    min-width: 0;
  }

  .projects-toolbar-select select {
    width: 100%;
    min-width: 0;
  }

  .projects-view-toggle {
    justify-self: start;
  }

  .projects-filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .projects-filter-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .form-grid,
  .form-grid-pair,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .form-grid label,
  .form-grid .full {
    min-width: 0;
    width: 100%;
  }

  input[type="date"],
  input[type="time"],
  input[type="number"],
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="search"],
  input[type="url"],
  input[type="tel"],
  select,
  textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
  }

  .sidebar {
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .logout-form {
    margin-top: 16px;
  }

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

  .stat-card {
    min-height: 88px;
    padding: 14px;
    gap: 12px;
    border-radius: 12px;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }

  .stat-card span {
    font-size: 11px;
  }

  .stat-card strong {
    font-size: 20px;
  }

  .money-totals-extra {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
  }

  .money-totals-more summary {
    font-size: 11px;
  }

  .money-totals-list {
    font-size: 11px;
  }

  .stat-card small {
    display: none;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .panel-head h2 {
    font-size: 16px;
  }

  .panel-head .small-button {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 0;
  }

  .panel-head .small-button::before {
    content: "+";
    font-size: 24px;
  }

  .small-button {
    width: auto;
    height: auto;
    padding: 10px 14px;
    font-size: 13px;
  }

  .list-item {
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
    align-items: start;
  }

  .list-item form {
    grid-column: 1 / -1;
  }

  .thumb {
    width: 72px;
    height: 72px;
  }

  .item-main strong {
    font-size: 14px;
  }

  .item-main p,
  .item-main small,
  .item-main a,
  .list-item time {
    font-size: 12px;
  }

  .projects-list-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .projects-hub-stats {
    grid-template-columns: 1fr;
  }

  .projects-stat-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .projects-list-panel {
    padding: 14px;
    overflow-x: hidden;
  }

  .projects-toolbar-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .project-card-v2-main {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 12px 8px;
  }

  .project-card-v2-content {
    min-height: 0;
  }

  .project-card-v2-cover {
    width: 100%;
    flex: 0 0 auto;
    height: 168px;
    min-height: 168px;
    max-height: 168px;
    margin-bottom: 10px;
  }

  .project-card-v2-cover-media {
    border-radius: 14px;
  }

  .project-card-v2-inner {
    min-height: 0;
  }

  .project-card-v2-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .project-card-deadline {
    font-size: 0.78rem;
    line-height: 1.35;
    flex-wrap: wrap;
  }

  .project-card-v2-finance strong {
    font-size: 0.84rem;
  }

  .project-card-footer-actions {
    width: 100%;
    justify-content: stretch;
  }

  .project-card-footer-actions .action-button,
  .project-card-footer-actions .inline-form {
    flex: 1;
  }

  .project-card-footer-actions .inline-form .action-button {
    width: 100%;
  }

  .projects-recent-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .content {
    padding: 12px;
    width: 100%;
    max-width: 100%;
  }

  .projects-cards-grid {
    grid-template-columns: 1fr;
  }

  .projects-hub-head-row {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .projects-hub-head-row h1 {
    flex: 1 1 100%;
  }

  .projects-hub-search {
    order: 2;
    flex: 1 1 100%;
    max-width: none;
    margin-left: 0;
  }

  .projects-hub-actions {
    order: 3;
  }

  .projects-hub-head {
    gap: 12px;
  }

  .project-card-v2-cover {
    margin-left: auto;
    margin-right: auto;
  }

  .projects-hub-actions .action-button {
    flex: 1 1 auto;
    width: 100%;
    justify-content: center;
  }

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

  .projects-cards-grid.is-compact-grid {
    grid-template-columns: 1fr;
  }

  .projects-cards-grid.is-compact-grid .project-card-v2-main {
    flex-direction: column;
  }

  .projects-cards-grid.is-compact-grid .project-card-v2-cover {
    width: 100%;
    flex: 0 0 auto;
    height: 168px;
    min-height: 168px;
    max-height: 168px;
    margin-bottom: 10px;
  }

  .projects-cards-grid.is-compact-grid .project-card-v2-cover-media {
    border-radius: 14px;
    clip-path: inset(0 round 14px);
  }

  .projects-cards-grid.is-compact-grid .project-card-v2-inner {
    min-height: 0;
  }

  .project-card-v2-finance {
    grid-template-columns: 1fr;
  }

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

  .settings-tabs a,
  .settings-tabs button.admin-tab-trigger {
    text-align: center;
    padding: 10px 12px;
    font-size: 13px;
  }

  .settings-inline-form {
    grid-template-columns: 1fr;
  }

  .settings-inline-form .action-button {
    width: 100%;
    min-width: 0;
    height: 46px;
    font-size: 13px;
  }

  .settings-list-row {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .settings-category-name [data-category-title] {
    font-size: 16px;
  }

  .settings-edit-form {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .settings-edit-form .action-button,
  .settings-edit-form .secondary-button,
  .settings-edit-form .danger {
    width: 100%;
    min-width: 0;
    height: 46px;
    font-size: 13px;
  }

  .settings-category-row .settings-row-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px 46px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
  }

  .settings-category-row.is-editing .settings-row-actions {
    display: grid;
    grid-template-columns: 46px 46px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
  }

  .settings-row-actions form {
    width: 100%;
  }

  .settings-row-actions .action-button:not(.icon-action-button) {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 10px;
    font-size: 13px;
  }

  .settings-row-actions .icon-action-button {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
  }

  .sidebar .nav-icon-img {
    width: 28px;
    height: 28px;
  }
}

.content {
  overflow-x: clip;
}

.form-panel,
.expense-item-row {
  max-width: 100%;
}

.bottom-nav {
  display: none;
}

.bottom-more-menu {
  position: fixed;
  right: 12px;
  bottom: 82px;
  z-index: 60;
  width: 220px;
  padding: 10px;
  background: #071827;
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-more-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.bottom-more-menu a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-disabled {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 10px;
  color: rgba(248, 250, 252, 0.38);
  background: rgba(255, 255, 255, 0.03);
  cursor: not-allowed;
  user-select: none;
  pointer-events: none;
}

.nav-disabled span:first-child {
  width: 24px;
  text-align: center;
  font-size: 20px;
  opacity: 0.65;
}

.bottom-nav-disabled {
  width: 100%;
  min-width: 0;
  height: 74px;
  padding: 6px 0 4px;
  border: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: rgba(203, 213, 225, 0.35);
  background: transparent;
  box-shadow: none;
}

.bottom-nav-disabled .bottom-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 28px;
  line-height: 1;
  opacity: 0.55;
}

.bottom-nav-disabled .bottom-label {
  font-size: 11px;
  line-height: 1;
}

.bottom-more-menu .nav-disabled {
  display: block;
  padding: 13px 14px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.03);
}

.bottom-logout-form {
  margin-top: 8px;
}

.bottom-admin-link {
  margin-top: 4px;
  border: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
  justify-content: center;
}

.bottom-admin-link:hover {
  background: rgba(56, 189, 248, 0.22);
}

.bottom-logout-button {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  font-weight: 800;
  box-shadow: none;
}

@media (max-width: 720px) {
  body:not(.site-body) {
    padding-bottom: 86px;
  }

  body.sidebar-open .bottom-nav {
    visibility: hidden;
    pointer-events: none;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: 68px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0 2px env(safe-area-inset-bottom);
    background: var(--dark);
    color: #fff;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.22);
  }

  .bottom-nav a,
  .bottom-nav button {
    width: 100%;
    min-width: 0;
    height: 68px;
    padding: 4px 0 2px;
    border: 0;
    border-radius: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    background: transparent;
    color: #cbd5e1;
    box-shadow: none;
    font-size: 20px;
    font-weight: 500;
  }

  .bottom-nav .bottom-icon,
  .bottom-nav .nav-icon {
    width: 28px;
    height: 28px;
  }

  .bottom-nav .nav-icon-img {
    width: 24px;
    height: 24px;
  }

  .bottom-nav a span:not(.nav-icon):not(.nav-icon-fallback),
  .bottom-nav button span:not(.nav-icon):not(.nav-icon-fallback) {
    font-size: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
  }

  .bottom-nav a.active,
  .bottom-nav button.active {
    color: #60a5fa;
  }

  .bottom-nav button:hover,
  .bottom-nav a:hover {
    filter: none;
    background: rgba(255, 255, 255, 0.04);
  }

  .bottom-more-menu {
    right: 14px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: min(260px, calc(100vw - 28px));
  }
}

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

.timeline-list {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-photo {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  overflow: hidden;
  background: #e8eef6;
}

.timeline-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.timeline-content {
  min-width: 0;
}

.timeline-content strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.timeline-content p {
  margin: 0 0 8px;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.timeline-content small {
  color: var(--muted);
}

.journal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.journal-pagination-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.journal-pagination-jump {
  flex-shrink: 0;
}

.journal-pagination > .action-button,
.journal-pagination > .secondary-button,
.journal-pagination > span.action-button,
.journal-pagination > span.secondary-button {
  flex-shrink: 1;
  min-width: 0;
}

.journal-pagination > .action-button:disabled,
.journal-pagination > .secondary-button:disabled,
.journal-pagination > span.action-button[aria-disabled="true"],
.journal-pagination > span.secondary-button[aria-disabled="true"] {
  opacity: 0.52;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
  box-shadow: none;
}

@media (max-width: 900px) {
  .journal-pagination {
    gap: 6px;
    padding: 0 2px;
  }

  .journal-pagination > .action-button,
  .journal-pagination > .secondary-button,
  .journal-pagination > span.action-button,
  .journal-pagination > span.secondary-button {
    padding: 8px 10px;
    height: 38px;
    font-size: 0.78rem;
  }

  .journal-pagination-label {
    font-size: 0.82rem;
  }
}

@media (max-width: 720px) {
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-header .action-button {
    width: 100%;
  }

  .timeline-item {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .timeline-photo {
    width: 72px;
    height: 72px;
    border-radius: 12px;
  }

  .timeline-content strong {
    font-size: 15px;
  }

  .timeline-content p,
  .timeline-content small {
    font-size: 12px;
  }
}

.project-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.project-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.project-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.project-stats span {
  color: var(--muted);
  font-size: 0.78rem;
}

.project-stats strong {
  font-size: 0.95rem;
}

.activity-log-list {
  display: grid;
  gap: 10px;
}

.activity-log-row {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.activity-log-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.activity-log-meta time {
  color: var(--muted);
  font-size: 0.82rem;
}

.activity-log-row p {
  margin: 6px 0;
  color: var(--text);
}

.activity-log-row small {
  color: var(--muted);
}

.delete-project-warning {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #fecaca;
  background: linear-gradient(180deg, #fff5f5 0%, #fee2e2 100%);
  color: #991b1b;
}

.delete-project-warning strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.delete-project-warning p {
  margin: 0;
  line-height: 1.55;
  font-size: 0.92rem;
}

.delete-project-warning-last {
  margin-top: 12px;
  border-color: #fdba74;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  color: #9a3412;
}

.project-readonly-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.project-readonly-banner p {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.form-grid-compact textarea {
  min-height: 72px;
}

.project-status-workflow {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.project-reopen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-budget-stack {
  display: grid;
  gap: 0;
}

.form-budget-stack > label.full {
  grid-column: 1 / -1;
}

.form-budget-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.form-budget-hint {
  margin-top: -8px;
}

.form-budget-currency .field-hint {
  display: none;
}

.project-status-workflow-standalone {
  margin-top: 16px;
}

@media (max-width: 720px) {
  .form-budget-row {
    grid-template-columns: 1fr;
  }
}

.js-entry-open {
  cursor: pointer;
}

.expense-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.expense-item:last-child {
  border-bottom: 0;
}

.expense-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #e7f8ee;
  color: var(--green);
  font-size: 20px;
  flex-shrink: 0;
}

.expense-icon-glyph {
  line-height: 1;
}

.expense-icon-tone-green { background: rgba(34, 197, 94, 0.16); }

.expense-icon-tone-orange { background: rgba(249, 115, 22, 0.16); }

.expense-icon-tone-yellow { background: rgba(234, 179, 8, 0.18); }

.expense-icon-tone-blue { background: rgba(59, 130, 246, 0.16); }

.expense-icon-tone-brown { background: rgba(180, 83, 9, 0.16); }

.expense-icon-tone-purple { background: rgba(139, 92, 246, 0.16); }

.expense-icon-tone-teal { background: rgba(20, 184, 166, 0.16); }

.expense-icon-tone-rose { background: rgba(225, 29, 72, 0.16); }

.expense-icon-tone-slate { background: rgba(100, 116, 139, 0.16); }

.expense-item > div:nth-child(2) {
  min-width: 0;
  overflow: hidden;
}

.expense-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.expense-item p {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 13px;
  line-height: 1.45;
}

.expense-item .muted,
.expense-item small {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.amount {
  text-align: right;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.amount small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.expense-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expense-actions form {
  margin: 0;
  display: flex;
}

.desktop-label {
  display: inline;
}

.mobile-label {
  display: none;
}

.details-button {
  white-space: nowrap;
}

.expense-actions .action-button,
.expense-actions .details-button,
.expense-actions .danger,
.expense-actions .attachment-button {
  height: 42px;
  min-width: 92px;
  padding: 0 14px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 13px;
  font-weight: 800;
}

.expense-actions .action-button:hover,
.expense-actions .action-button:focus-visible,
.expense-actions .details-button:hover,
.expense-actions .details-button:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: var(--brand-shadow);
}

.expense-actions .danger:hover,
.expense-actions .danger:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.attachment-button {
  min-width: 42px;
  width: 42px;
  padding: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #eef6ff, #dbeafe);
  color: #1d5dad;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
  transition: 0.2s;
}

.attachment-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.details-button {
  background: var(--brand-gradient);
  color: #ffffff;
  border: 1px solid color-mix(in srgb, var(--brand-primary-dark) 28%, transparent);
}

.details-button:hover,
.details-button:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: var(--brand-shadow);
}

.details-button:disabled,
.details-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 720px) {
  .attachment-button {
    font-size: 21px;
  }

  .expense-actions {
    margin-top: 8px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .expense-actions .action-button,
  .expense-actions .details-button,
  .expense-actions .danger,
  .expense-actions .attachment-button {
    width: 52px;
    min-width: 52px;
    height: 46px;
    padding: 0;
    border-radius: 12px;
    font-size: 0;
    flex: 0 0 auto;
  }

  .expense-actions .action-button .mobile-label,
  .expense-actions .details-button .mobile-label {
    font-size: 22px;
  }

  .expense-actions .danger {
    width: auto;
    min-width: 82px;
    padding: 0 14px;
    font-size: 17px;
  }

  .details-button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    padding: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
  }

  .details-button::before {
    content: none !important;
  }

  .desktop-label {
    display: none;
  }

  .mobile-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    margin: 0;
    padding: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    text-transform: lowercase;
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #f8fbff;
}

.toggle-field-desc {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-switch-track {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}

.toggle-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--brand-primary-dark);
}

.toggle-switch input:checked + .toggle-switch-track::after {
  transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-switch-track {
  outline: 2px solid color-mix(in srgb, var(--brand-primary-light) 65%, #fff);
  outline-offset: 2px;
}

.toggle-switch-state {
  min-width: 2.4em;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
}

.toggle-switch input:checked ~ .toggle-switch-state {
  color: var(--brand-primary-dark);
}

.multi-expense-toggle {
  margin: 14px 0;
}

.project-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.project-summary-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.project-summary-hero img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.project-summary-hero-meta h2 {
  margin: 0 0 4px;
}

.project-summary-hero-meta p {
  margin: 0;
}

.project-summary-stat {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--brand-surface-muted);
}

.project-summary-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.project-summary-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.project-summary-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.project-summary-list li:last-child {
  border-bottom: 0;
}

.project-summary-list span {
  color: var(--muted);
  font-size: 0.86rem;
}

.project-summary-breakdown {
  margin: -8px 0 12px;
  font-size: 0.82rem;
}

.project-cover-preview img {
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.badge-active {
  background: #dcfce7;
  color: #166534;
}

.badge-preparation {
  background: #ffedd5;
  color: #9a3412;
}

.badge-completed {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.text-danger {
  color: #dc2626;
}

.items-table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  table-layout: fixed;
}

.items-table th,
.items-table td {
  padding: 10px;
  border-bottom: 1px solid #e1e8f0;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.items-table th:first-child,
.items-table td:first-child,
.items-table-name {
  width: 42%;
}

.items-table th:nth-child(2),
.items-table td:nth-child(2) {
  width: 14%;
}

.items-table th:nth-child(3),
.items-table td:nth-child(3) {
  width: 22%;
}

.items-table th:nth-child(4),
.items-table td:nth-child(4) {
  width: 22%;
}

.form-message {
  margin: 8px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.form-grid > .form-message,
.form-grid > .form-message.full,
.form-panel > .form-message.full {
  grid-column: 1 / -1;
  text-align: center;
  margin: 0 0 12px;
}

.form-message.success {
  background: #e8f8ee;
  color: #166534;
  border-color: #bbf7d0;
}

.form-message.error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.form-message-link {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-message.hidden {
  display: none;
}

.file-field {
  display: grid;
  gap: 8px;
}

.file-field-label {
  font-weight: 600;
}

.file-field-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0;
  border: 0;
  background: transparent;
}

.file-field-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
}

.file-field-clear {
  flex-shrink: 0;
  min-width: auto;
  height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.file-field-clear:hover {
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, var(--panel));
  color: #ef4444;
  border-color: color-mix(in srgb, #ef4444 35%, var(--line));
}

.file-field-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-field-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: var(--brand-shadow);
  transition: filter 0.2s ease, transform 0.2s ease;
}

.file-field-picker:hover .file-field-button,
.file-field-picker:focus-within .file-field-button {
  filter: brightness(0.96);
}

.file-field-name {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-field-name.has-file {
  color: var(--text);
  font-weight: 600;
}

.file-field-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.file-field-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.file-field-previews[hidden] {
  display: none;
}

.file-field-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  cursor: default;
}

.file-field-preview img,
.file-field-preview-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-field-preview-fallback {
  display: grid;
  place-items: center;
  padding: 6px;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
  text-align: center;
  word-break: break-word;
}

.file-field-preview.is-rejected {
  cursor: pointer;
  outline: 2px solid #ef4444;
  outline-offset: -2px;
}

.file-field-preview.is-rejected img {
  filter: grayscale(0.35) brightness(0.82);
}

.file-field-preview-warn {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
}

.file-field-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.file-field-preview-remove:hover {
  background: #ef4444;
}

.file-field-picker.file-field-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px color-mix(in srgb, #ef4444 35%, transparent);
}

@media (max-width: 640px) {
  .file-field-control {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .file-field-picker {
    width: 100%;
  }

  .file-field-clear {
    width: 100%;
  }
}

.bbcode-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.bbcode-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bbcode-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.bbcode-quote {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, var(--panel));
  border-radius: 0 10px 10px 0;
  overflow: hidden;
}

.bbcode-quote .bbcode-list,
.bbcode-quote ul,
.bbcode-quote ol {
  margin: 0;
  padding-left: 20px;
}

.bbcode-list {
  margin: 0;
  padding-left: 20px;
}

.bbcode-list-dash {
  list-style: none;
  padding-left: 0;
}

.bbcode-list-dash li::before {
  content: "- ";
  color: var(--muted);
}

/* Zagnieżdżone listy (lista w punkcie listy) - własny odstęp od góry, żeby nie
   sklejały się wizualnie z tekstem punktu nadrzędnego, i wcięcie od lewej
   niezależnie od typu listy (kropki/numery/myślniki). */
.bbcode-list ul,
.bbcode-list ol {
  margin-top: 4px;
  margin-bottom: 0;
  padding-left: 20px;
}

.bbcode-list ul.bbcode-list-dash,
.bbcode-list ol.bbcode-list-dash {
  padding-left: 16px;
}

.rich-editor-wrap {
  display: grid;
  gap: 8px;
  position: relative;
  padding-bottom: 1.35rem;
}

.rich-editor-counter {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 0;
}

.rich-editor-size-wrap {
  position: relative;
}

.rich-editor-size-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 140px;
}

.rich-editor-size-btn {
  min-width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  touch-action: manipulation;
}

.rich-editor-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.rich-editor-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.rich-editor-btn.is-active,
.rich-editor-size-trigger.is-active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 12%, var(--panel));
  color: var(--blue);
}

.rich-editor-surface {
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}

.rich-editor-surface:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.rich-editor-surface blockquote {
  margin: 0 0 6px;
  padding: 8px 12px;
  border-left: 4px solid var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, var(--panel));
  border-radius: 0 10px 10px 0;
  overflow: hidden;
}

.rich-editor-surface blockquote ul,
.rich-editor-surface blockquote ol {
  margin: 0;
  padding-left: 20px;
}

.rich-editor-surface blockquote .bbcode-list {
  margin: 0;
  padding-left: 20px;
}

.rich-editor-surface blockquote:last-child {
  margin-bottom: 0;
}

.rich-editor-surface blockquote:empty {
  display: none;
}

.rich-editor-surface > div,
.rich-editor-surface > p {
  margin: 0;
  padding: 0;
  min-height: 0;
}

.rich-editor-surface ul,
.rich-editor-surface ol {
  margin: 0;
  padding-left: 20px;
}

.rich-editor-color-wrap {
  position: relative;
}

.rich-editor-color-trigger {
  color: var(--blue);
}

.rich-editor-color-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(6, 22px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rich-editor-color-swatch {
  width: 22px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.rich-editor-color-swatch:hover {
  transform: scale(1.08);
}

.rich-editor-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: block;
  background: linear-gradient(135deg, #2563eb 50%, #dc2626 50%);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.rich-editor-emoji-wrap {
  position: relative;
}

.rich-editor-emoji-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(6, 34px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rich-editor-emoji-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  font-size: 18px;
}

.rich-editor-surface ul ul,
.rich-editor-surface ol ol,
.rich-editor-surface ul ol,
.rich-editor-surface ol ul {
  margin-top: 4px;
}

.dashboard-expense-list {
  display: grid;
}

.dashboard-expense-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-expense-item:last-child {
  border-bottom: 0;
}

.dashboard-expense-main {
  min-width: 0;
  overflow: hidden;
}

.dashboard-expense-main strong {
  display: block;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-expense-main p {
  margin: 0 0 4px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.dashboard-expense-main small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-expense-amount {
  text-align: right;
  white-space: nowrap;
}

.dashboard-expense-amount strong {
  display: block;
}

.dashboard-expense-amount small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.plans-section-title {
  margin: 18px 0 10px;
  font-size: 1rem;
}

.plans-section-title.is-done {
  color: var(--muted);
}

.mini-card.is-done {
  opacity: 0.82;
}

.mini-card.is-done h2 {
  text-decoration: line-through;
}

.plans-done-grid {
  margin-bottom: 8px;
}

.page-fab-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 190px;
  padding: 8px;
  border-radius: 14px;
  background: #071827;
  color: #fff;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.45);
}

.page-fab-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.page-fab-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.page-fab-menu button span {
  width: 28px;
  text-align: center;
}

.page-fab-menu button em {
  font-style: normal;
}

.plan-empty,
.attachment-empty {
  grid-column: 1 / -1;
}

.file-link {
  display: inline-block;
  max-width: 100%;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-link:hover {
  text-decoration: underline;
}

input.is-auto-calculated {
  opacity: 0.85;
  cursor: not-allowed;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
  line-height: 1.35;
}

.field-counter {
  display: block;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  text-align: right;
  line-height: 1.2;
}

.field-counter.field-counter-limit {
  color: #b45309;
  font-weight: 600;
}

.plan-badge,
.user-menu-trigger .plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 6px;
  vertical-align: middle;
}

.plan-badge-free {
  background: #111827;
  color: #f8fafc;
}

.plan-badge-pro {
  background: #f97316;
  color: #fff;
}

.plan-badge-max {
  background: #dc2626;
  color: #fff;
}

.oauth-google-badge-icon {
  display: block;
  flex-shrink: 0;
}

.oauth-google-badge-text {
  letter-spacing: 0.02em;
}

.password-strength {
  grid-column: 1 / -1;
  margin-top: -0.35rem;
}

.password-strength:not(.is-active) {
  display: none;
}

.password-strength-bar {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.password-strength-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.2s ease, background-color 0.2s ease;
  background: #94a3b8;
}

.password-strength-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: #64748b;
  min-height: 0;
}

.password-strength-label:empty {
  display: none;
}

.password-strength.is-weak .password-strength-bar span {
  background: #ef4444;
}

.password-strength.is-fair .password-strength-bar span {
  background: #f97316;
}

.password-strength.is-good .password-strength-bar span {
  background: #eab308;
}

.password-strength.is-strong .password-strength-bar span {
  background: #22c55e;
}

.user-menu-head .plan-badge {
  display: none;
}

.email-verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
  border: 1px solid transparent;
}

.email-verify-badge.is-verified {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.email-verify-badge.is-unverified {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.auth-card-badge-max {
  background: #dc2626;
  color: #fff;
}

.user-menu-plan {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.user-menu-plan strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
}

.user-menu-plan-name-pro {
  color: #f97316;
}

.user-menu-plan-name-max {
  color: #dc2626;
}

.user-menu-plan-status-ok {
  color: #22c55e;
  font-weight: 700;
}

.user-menu-plan.is-warn .user-menu-plan-link {
  color: #ea580c;
}

.user-menu-plan-link {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  text-decoration: none;
}

.user-menu-plan-link:hover {
  text-decoration: underline;
}

.user-menu-storage {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.user-menu-storage strong {
  color: var(--text);
  font-size: 12px;
}

.user-menu-storage-bar {
  width: 100%;
}

.user-menu-storage-warn {
  color: #ea580c;
  font-size: 11px;
  line-height: 1.4;
}

.user-menu-panel a.user-menu-admin-link {
  display: block;
  border: 2px solid #38bdf8;
  background: color-mix(in srgb, #38bdf8 12%, transparent);
  color: #0369a1;
  margin: 4px 8px;
  border-radius: 10px;
  text-align: center;
}

.user-menu-panel a.user-menu-admin-link:hover {
  background: color-mix(in srgb, #38bdf8 20%, transparent);
}

.panel-search-modal-box {
  max-width: 560px;
}

.panel-search-field {
  display: block;
  position: relative;
  margin: 14px 0 10px;
}

.panel-search-field input {
  width: 100%;
  padding: 12px 44px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 15px;
}

.panel-search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
}

.panel-search-results {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.panel-search-result {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}

.panel-search-result-type {
  display: inline-block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--blue);
}

.panel-search-result strong {
  display: block;
  font-size: 14px;
}

.panel-search-result small {
  color: var(--muted);
}

.panel-search-hint {
  margin: 0;
  font-size: 13px;
}

/* Wspólny nagłówek strony - h1 + podtytuł (muted) */
.page-section-head {
  margin-bottom: 16px;
}
.page-section-head h1 {
  margin: 0 0 4px;
}
.page-section-head p {
  margin: 0;
  font-size: .9rem;
}

.notes-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.notes-page-head h1 {
  margin: 0 0 6px;
}

.notes-page-toolbar {
  margin-bottom: 12px;
}

.page-form-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin: 0 0 12px;
}

.attachments-filter-select,
.plans-sort-select {
  width: auto;
  min-width: 130px;
  max-width: 200px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 28px 7px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% + 2px),
    calc(100% - 9px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.attachments-filter-label,
.plans-sort-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.notes-page-stat {
  margin-bottom: 16px;
}

.notes-page-stat-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.notes-page-stat-card strong {
  font-size: 22px;
}

.notes-page-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 8%, var(--panel));
}

.notes-page-stat-icon img {
  display: block;
}

.notes-page-empty {
  padding: 28px 24px;
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.notes-page-panel {
  padding: 0;
  overflow: hidden;
}

.notes-page-list-meta {
  margin: 0 0 12px;
  padding: 16px 18px 0;
  font-size: 0.88rem;
}

.notes-pagination {
  margin: 0 18px 16px;
}

.notes-page-list {
  display: grid;
  gap: 0;
}

.notes-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.notes-item:last-child {
  border-bottom: 0;
}

.notes-item:hover {
  background: color-mix(in srgb, var(--blue) 4%, var(--panel));
}

.notes-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 8%, var(--panel));
}

.notes-item-icon img {
  display: block;
}

.notes-item-main {
  min-width: 0;
}

.notes-item-main strong {
  display: block;
  margin-bottom: 4px;
}

.notes-item-main p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notes-item-date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.notes-item-actions {
  justify-self: end;
}

@media (max-width: 900px) {
  .notes-item {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px 12px;
    align-items: start;
    padding: 13px 16px;
  }

  .notes-item-icon {
    width: 42px;
    height: 42px;
    grid-row: 1;
    grid-column: 1;
    align-self: start;
  }

  .notes-item-main {
    grid-column: 2;
    grid-row: 1;
  }

  .notes-item-main strong {
    margin-bottom: 4px;
  }

  .notes-item-date {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .notes-item-actions {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
    width: auto;
    margin-top: 0;
  }
}

.summary-donut-area {
  height: 220px;
}

.expense-add-form.is-collapsed {
  display: none;
}

.expense-current-attachment {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.expense-attachment-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.expense-attachment-preview img {
  display: block;
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.expense-attachment-preview.is-file {
  gap: 10px;
  padding: 12px;
  justify-content: flex-start;
}

.expense-attachment-preview-badge {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.expense-attachment-preview-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.expense-current-attachment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-premium-page {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.panel-premium-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.panel-premium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

.panel-premium-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-premium-card.is-featured {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--blue) 12%, transparent);
}

.panel-premium-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.panel-premium-price {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.panel-premium-features {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
}

.panel-premium-footnote {
  margin-top: 12px;
}

.panel-premium-lead {
  margin: 0;
  max-width: 62ch;
}

.panel-premium-status {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.4fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 10%, var(--panel)), var(--panel));
  box-shadow: var(--shadow);
}

.panel-premium-status.is-warn {
  border-color: color-mix(in srgb, #f59e0b 40%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 12%, var(--panel)), var(--panel));
}

.panel-premium-status.is-danger {
  border-color: color-mix(in srgb, #ef4444 45%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, #ef4444 12%, var(--panel)), var(--panel));
}

.panel-premium-status-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-premium-status-plan-name {
  font-size: 1.15rem;
}

.plan-days-left.is-warn {
  color: #dc2626;
  font-weight: 800;
}

.panel-premium-status-expiry,
.panel-premium-status-hold {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.panel-premium-status-hold {
  color: #2563eb;
}

.panel-premium-history-list {
  display: grid;
  gap: 10px;
}

.panel-premium-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.panel-premium-history-row strong,
.panel-premium-history-row small {
  display: block;
}

.panel-premium-history-row small {
  margin-top: 4px;
  color: var(--muted);
}

.panel-premium-status-plan.is-pro .panel-premium-status-plan-name {
  color: #2563eb;
}

.panel-premium-status-plan.is-max .panel-premium-status-plan-name {
  color: #7c3aed;
}

.panel-premium-status-storage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-premium-storage-bar {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}

.panel-premium-storage-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.panel-premium-status.is-warn .panel-premium-storage-bar > span {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.panel-premium-status.is-danger .panel-premium-storage-bar > span {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.panel-premium-storage-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.panel-premium-status-actions {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.panel-premium-status-hint {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.panel-premium-current-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 700;
}

.panel-premium-compare {
  min-width: 0;
  overflow: hidden;
}

.panel-premium-compare-hint {
  display: none;
  margin: 0 0 10px;
}

.panel-premium-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel-premium-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.86rem;
}

.panel-premium-table th,
.panel-premium-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

.panel-premium-table td:first-child,
.panel-premium-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  white-space: normal;
  background: var(--panel);
}

.panel-premium-table thead th:first-child {
  background: color-mix(in srgb, var(--blue) 88%, #0f172a);
}

.panel-premium-table thead th {
  background: color-mix(in srgb, var(--blue) 88%, #0f172a);
  color: #fff;
  font-weight: 700;
}

.panel-premium-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--blue) 4%, transparent);
}

.panel-premium-table tbody tr:nth-child(even) td:first-child {
  background: color-mix(in srgb, var(--blue) 4%, var(--panel));
}

.panel-premium-table tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 980px) {
  .panel-premium-grid {
    grid-template-columns: 1fr;
  }

  .panel-premium-status {
    grid-template-columns: 1fr;
  }

  .panel-premium-compare-hint {
    display: block;
  }

  .panel-premium-history-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .panel-premium-history-row .muted {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .panel-premium-head h1 {
    font-size: 1.5rem;
  }

  .panel-premium-card,
  .panel-premium-status {
    padding: 14px;
  }

  .panel-premium-table th,
  .panel-premium-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}
