/* ДелоДня (WorkDay) — Warm Architectural Minimalism, Mobile-First */

:root,
[data-theme="sage"] {
  --body-bg: linear-gradient(155deg, #eff0e8 0%, #e4e6dc 52%, #d8ddd0 100%);
  --topbar-bg: rgba(242, 244, 237, 0.94);
  --nav-bg: rgba(245, 246, 241, 0.98);
  --card-bg: rgba(252, 253, 250, 0.96);
  --card-bg-solid: #fcfdfa;
  --card-border: rgba(138, 154, 141, 0.30);
  --pill-bg: #e4e9e0;
  --input-bg: #f6f8f4;
  --ink-primary: #1f2622;
  --ink-secondary: #4c5a52;
  --ink-muted: #76847b;
  --accent: #365746;
  --accent-dark: #253d30;
  --accent-warm: #c06e48;
  --accent-soft: rgba(54, 87, 70, 0.12);
  --warm-soft: rgba(192, 110, 72, 0.13);
  --danger: #b5453a;
  --danger-soft: rgba(181, 69, 58, 0.11);
  --success: #3c7a57;
  --divider: rgba(112, 130, 116, 0.22);
  --shadow-card: 0 8px 24px rgba(28, 44, 35, 0.07), 0 1px 2px rgba(28, 44, 35, 0.04);
  --shadow-float: 0 16px 40px rgba(24, 38, 30, 0.16);
  --radius-card: 20px;
  --radius-sm: 12px;
  --font-serif: "Lora", Georgia, serif;
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="graphite"] {
  --body-bg: linear-gradient(155deg, #eef0f4 0%, #e2e6ec 52%, #d5dbe4 100%);
  --topbar-bg: rgba(242, 244, 248, 0.94);
  --nav-bg: rgba(244, 246, 250, 0.98);
  --card-bg: rgba(252, 253, 255, 0.96);
  --card-bg-solid: #fcfdff;
  --card-border: rgba(132, 144, 162, 0.28);
  --pill-bg: #e5e9f0;
  --input-bg: #f4f6fa;
  --ink-primary: #1d232b;
  --ink-secondary: #495566;
  --ink-muted: #758294;
  --accent: #2d3b4e;
  --accent-dark: #1d2735;
  --accent-warm: #b57b45;
  --accent-soft: rgba(45, 59, 78, 0.11);
  --warm-soft: rgba(181, 123, 69, 0.14);
  --danger: #b5453a;
  --danger-soft: rgba(181, 69, 58, 0.11);
  --success: #347a5b;
  --divider: rgba(120, 134, 152, 0.22);
}

[data-theme="sand"] {
  --body-bg: linear-gradient(155deg, #f4efe7 0%, #ebe3d7 52%, #dfd5c5 100%);
  --topbar-bg: rgba(246, 241, 234, 0.94);
  --nav-bg: rgba(248, 243, 237, 0.98);
  --card-bg: rgba(255, 253, 249, 0.96);
  --card-bg-solid: #fffdf9;
  --card-border: rgba(173, 154, 130, 0.30);
  --pill-bg: #ede5d8;
  --input-bg: #faf6ef;
  --ink-primary: #29221b;
  --ink-secondary: #625447;
  --ink-muted: #8c7d6e;
  --accent: #7a4b2f;
  --accent-dark: #5c3620;
  --accent-warm: #c06e48;
  --accent-soft: rgba(122, 75, 47, 0.11);
  --warm-soft: rgba(192, 110, 72, 0.14);
  --danger: #b5453a;
  --danger-soft: rgba(181, 69, 58, 0.11);
  --success: #467954;
  --divider: rgba(154, 136, 114, 0.24);
}

/* --- Deep Black / Dark Mode --- */
[data-mode="dark"] {
  color-scheme: dark;
  --body-bg: linear-gradient(165deg, #070808 0%, #0b0d0c 60%, #101311 100%);
  --topbar-bg: rgba(11, 13, 12, 0.94);
  --nav-bg: rgba(11, 13, 12, 0.98);
  --card-bg: #141816;
  --card-bg-solid: #141816;
  --card-border: rgba(255, 255, 255, 0.09);
  --pill-bg: #1f2522;
  --input-bg: #1b201d;
  --ink-primary: #f2f5f3;
  --ink-secondary: #b5c0b9;
  --ink-muted: #7f8c84;
  --accent: #4c8c69;
  --accent-dark: #3b7153;
  --accent-warm: #d48259;
  --accent-soft: rgba(76, 140, 105, 0.20);
  --warm-soft: rgba(212, 130, 89, 0.18);
  --danger: #e06b60;
  --danger-soft: rgba(224, 107, 96, 0.18);
  --success: #53a978;
  --divider: rgba(255, 255, 255, 0.09);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-float: 0 18px 44px rgba(0, 0, 0, 0.65);
}

[data-mode="dark"][data-theme="graphite"] {
  --body-bg: linear-gradient(165deg, #07080a 0%, #0b0d11 60%, #11151b 100%);
  --topbar-bg: rgba(10, 12, 16, 0.94);
  --nav-bg: rgba(10, 12, 16, 0.98);
  --card-bg: #13171e;
  --card-bg-solid: #13171e;
  --pill-bg: #1d232e;
  --input-bg: #191f28;
  --accent: #5e84b0;
  --accent-dark: #486b94;
  --accent-soft: rgba(94, 132, 176, 0.22);
}

[data-mode="dark"][data-theme="sand"] {
  --body-bg: linear-gradient(165deg, #0a0807 0%, #100d0b 60%, #171310 100%);
  --topbar-bg: rgba(14, 11, 9, 0.94);
  --nav-bg: rgba(14, 11, 9, 0.98);
  --card-bg: #191512;
  --card-bg-solid: #191512;
  --pill-bg: #25201c;
  --input-bg: #201b17;
  --accent: #c57e50;
  --accent-dark: #a6653b;
  --accent-soft: rgba(197, 126, 80, 0.22);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  color: var(--ink-primary);
  background: var(--body-bg);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.45;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* --- Login --- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
}

.login-wrap {
  width: 100%;
  max-width: 390px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow-float);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 2px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Layout Shell --- */
.app-shell {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--divider);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 1;
}

.topbar-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.main-content {
  width: 100%;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.view {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.view[hidden] {
  display: none !important;
}

/* --- Cards & Buttons --- */
.card {
  width: 100%;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 15px;
  box-shadow: var(--shadow-card);
}

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

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted {
  color: var(--ink-muted);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-soft {
  background: var(--pill-bg);
  color: var(--ink-primary);
}

.btn-soft:hover {
  background: var(--accent-soft);
}

.btn-ghost {
  color: var(--ink-secondary);
  padding: 7px 10px;
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pill-bg);
  color: var(--ink-primary);
}

.btn-full {
  width: 100%;
  padding: 12px 16px;
}

/* --- Fields & Inputs --- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.field input,
.field textarea,
.field select,
.inline-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--ink-primary);
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.inline-input:focus {
  border-color: var(--accent);
  background: var(--card-bg-solid);
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

/* --- Calendar Widget --- */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-month-label {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  text-transform: capitalize;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.cal-weekdays span:nth-child(6),
.cal-weekdays span:nth-child(7) {
  color: var(--accent-warm);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  min-height: 48px;
  border-radius: 12px;
  padding: 5px 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  position: relative;
  border: 1.5px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cal-cell:hover:not(.cal-empty) {
  background: var(--accent-soft);
}

.cal-cell.cal-empty {
  cursor: default;
}

.cal-cell.is-today {
  background: var(--accent-soft);
  border-color: rgba(54, 87, 70, 0.32);
}

.cal-cell.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(38, 63, 50, 0.22);
}

.cal-cell.is-selected .cal-day-num,
.cal-cell.is-selected .cal-task-pill {
  color: #fff;
}

.cal-cell.is-off:not(.is-selected) {
  background: rgba(192, 110, 72, 0.08);
}

.cal-day-num {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.cal-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
  max-width: 34px;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
}

.cal-cell.is-selected .cal-dot {
  outline: 1px solid rgba(255, 255, 255, 0.7);
}

.cal-meta-row {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-muted);
}

.cal-cell.is-selected .cal-meta-row {
  color: rgba(255, 255, 255, 0.85);
}

/* --- Day Detail Card --- */
.day-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 14px;
}

.day-date-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  text-transform: capitalize;
}

.day-date-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.status-pills {
  display: flex;
  gap: 4px;
  background: var(--pill-bg);
  padding: 3px;
  border-radius: 11px;
}

.status-pill {
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.status-pill.active {
  background: var(--card-bg-solid);
  color: var(--ink-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.status-pill.active[data-status="urgent"] {
  color: var(--danger);
}

.status-pill.active[data-status="off"] {
  color: var(--accent-warm);
}

.day-section {
  margin-bottom: 18px;
}

.day-section:last-child {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

/* --- Day Projects Chips --- */
.day-projects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-project-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
}

.day-project-main {
  flex: 1;
  min-width: 0;
}

.day-project-title {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.day-project-addr {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.day-project-summary {
  margin-top: 6px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--divider);
  padding: 3px 0;
  font-size: 13px;
  color: var(--ink-secondary);
  outline: none;
}

.day-project-summary:focus {
  border-bottom-color: var(--accent);
  color: var(--ink-primary);
}

/* --- Tasks --- */
.task-add-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.task-add-row input {
  flex: 1;
  min-width: 0;
}

.task-add-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.task-project-select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  max-width: 210px;
}

.priority-toggle {
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--pill-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.priority-toggle.is-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 13px;
  background: var(--input-bg);
  border: 1px solid transparent;
  transition: opacity 0.15s ease;
}

.task-item.is-high {
  border-color: rgba(181, 69, 58, 0.28);
}

.task-item.is-done {
  opacity: 0.58;
}

.task-check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 7px;
  border: 2px solid var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  color: #fff;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.task-item.is-done .task-check {
  background: var(--success);
  border-color: var(--success);
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.task-item.is-done .task-title {
  text-decoration: line-through;
}

.task-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: var(--pill-bg);
  color: var(--ink-secondary);
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
}

.tag-urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.mini-action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 13px;
}

.mini-action:hover {
  background: var(--pill-bg);
  color: var(--ink-primary);
}

.mini-action.del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --- Diary Note --- */
.diary-textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  line-height: 1.5;
  outline: none;
}

.diary-textarea:focus {
  border-color: var(--accent);
  background: var(--card-bg-solid);
}

.save-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
}

/* --- Photo Bridge Placeholder --- */
.photo-bridge-box {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px dashed var(--card-border);
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-secondary);
}

/* --- Projects Tab --- */
.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-chip {
  padding: 7px 12px;
  border-radius: 99px;
  background: var(--pill-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--accent);
  color: #fff;
}

.project-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 5px solid var(--accent);
  border-radius: 18px;
  padding: 14px 15px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.project-card:active {
  transform: scale(0.99);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.project-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.project-card-addr {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.project-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--pill-bg);
  color: var(--ink-secondary);
}

.badge-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-paused {
  background: var(--warm-soft);
  color: var(--accent-warm);
}

.badge-done {
  background: rgba(60, 122, 87, 0.14);
  color: var(--success);
}

/* --- Color Swatches --- */
.color-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 99px;
  border: 3px solid transparent;
  transition: transform 0.12s ease;
}

.color-swatch.active {
  border-color: var(--ink-primary);
  transform: scale(1.1);
}

/* --- Settings & Search --- */
.search-bar {
  display: flex;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.search-bar .inline-input {
  flex: 1;
  min-width: 0;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-btn {
  padding: 10px 6px;
  border-radius: 13px;
  border: 1.5px solid var(--card-border);
  background: var(--input-bg);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.integration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.integration-row > div:first-child {
  flex: 1 1 170px;
  min-width: 0;
}

.integration-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.integration-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* --- Apps Hub --- */
.apps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.app-link-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.app-link-main {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.app-link-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--pill-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.app-link-text {
  min-width: 0;
  flex: 1;
}

.app-link-title {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-link-sub {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--divider);
  padding: 7px 8px calc(12px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-inner {
  max-width: 680px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  min-height: 50px;
  border-radius: 13px;
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 700;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-item svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

/* --- Modal Bottom Sheet --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 26, 22, 0.44);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-backdrop[hidden] {
  display: none !important;
}

@media (min-width: 600px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card-bg-solid);
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-float);
}

@media (min-width: 600px) {
  .modal-sheet {
    border-radius: 24px;
    padding: 22px;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.empty-state {
  text-align: center;
  padding: 22px 14px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* --- Smeta Integration Card --- */
.smeta-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.smeta-pill-link:hover {
  background: var(--accent);
  color: #fff;
}

.smeta-box {
  padding: 13px 14px;
  border-radius: 15px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
}

.smeta-box-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.smeta-sum {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.smeta-bar {
  height: 7px;
  border-radius: 99px;
  background: var(--pill-bg);
  overflow: hidden;
  margin: 9px 0 10px;
}

.smeta-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--success), var(--accent-warm));
}

.smeta-sections {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 11px;
}

.smeta-sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

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

/* --- Photo Grid & Lightbox --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 13px;
  overflow: hidden;
  background: var(--pill-bg);
  border: 1px solid var(--card-border);
  cursor: pointer;
}

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

.photo-tile-tag {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  background: rgba(20, 28, 24, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-img-wrap {
  width: 100%;
  max-height: 55dvh;
  border-radius: 14px;
  overflow: hidden;
  background: #141917;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-img-wrap img {
  max-width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  display: block;
}

/* --- Toast --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  background: var(--ink-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
}
