.card-icon-area {
    width: 100%;
    height: 160px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-icon-area > svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.photo-placeholder {
  width:110px;
  height:110px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  border-radius:8px;
  background:#eee;
  color:#777;
  font-size:12px;
  position:absolute;
  inset:0;
  z-index:0;
  text-align:center;
}
.card-photo-thumb > img {
  position:relative;
  z-index:1;
}
.card-photo-thumb .photo-load-error {
  display:none !important;
}

.card-photo-thumbs {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-top:6px;
}
.card-photo-thumb {
    position:relative;
    width:110px;
    height:110px;
    flex:0 0 110px;
    overflow:hidden;
    border-radius:8px;
}
.card-photo-load-more { margin-top:10px; padding:9px 14px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:#334155; font-size:14px; font-weight:600; cursor:pointer; }
.card-photo-load-more:hover { background:#f8fafc; border-color:#94a3b8; }
/* Cards with 2+ photos use the entire card for the thumbnails. */
.card-icon-area-hidden { display:none; }
.card-body-photo-full { padding:0; }
.card-body-photo-full .field > .label { display:none; }
.card-body-photo-full .card-photo-thumbs {
    margin:0;
    width:100%;
    gap:8px;
}
.card-body-photo-full .card-photo-thumb {
    width:calc(50% - 4px);
    height:auto;
    aspect-ratio:1 / 1;
    flex:0 0 calc(50% - 4px);
}
.card-body-photo-full .card-photo-thumb img {
    width:100% !important;
    height:100% !important;
    object-fit:cover;
}

.card-photo-more {
    position:absolute;
    z-index:2;
    inset:auto 6px 6px auto;
    min-width:30px;
    height:30px;
    padding:0 7px;
    display:flex;
    align-items:center;
    justify-content:center;
    box-sizing:border-box;
    border-radius:999px;
    background:rgba(0,0,0,.65);
    color:#fff;
    font-size:14px;
    font-weight:600;
    line-height:1;
    pointer-events:none;
}

.cell-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

textarea.cell {
    width: 100%;
    box-sizing: border-box;
    border: none;
    padding: 10px;
    font-size: 16px;
    font-family: inherit;
    min-height: 80px;
    resize: vertical;
}

.newline-btn {
    align-self: flex-start;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.newline-btn:hover {
    background: #f1f5f9;
}

.cover-editor{
    margin-top:12px;
    padding:14px;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    border-radius:10px;
}
.cover-editor-label{
    display:block;
    margin-bottom:8px;
    font-size:13px;
    font-weight:600;
    color:#475569;
}
.cover-editor-preview{
    display:block;
    width:100%;
    max-height:280px;
    object-fit:cover;
    border-radius:8px;
    margin-bottom:10px;
}
.cover-upload-btn{
    display:inline-block;
    border:1px solid #cbd5e1;
    background:white;
    color:#475569;
    border-radius:8px;
    padding:8px 12px;
    font-size:13px;
    cursor:pointer;
}
.cover-upload-btn:hover{background:#f1f5f9}
.cover-upload-status{
    display:inline-block;
    margin-left:8px;
    font-size:12px;
    color:#64748b;
}
.cover-progress-wrap{
    display:flex;
    align-items:center;
    gap:10px;
    margin-top:10px;
    width:100%;
    max-width:520px;
}
.cover-progress-track{
    flex:1;
    height:8px;
    background:#e2e8f0;
    border-radius:999px;
    overflow:hidden;
}
.cover-progress-bar{
    width:0%;
    height:100%;
    background:#2563eb;
    border-radius:999px;
    transition:width .15s ease;
}
.cover-progress-text{
    min-width:42px;
    font-size:12px;
    color:#64748b;
    text-align:right;
}
.cover-hidden-input{display:none}
.cover-photo-public-wrap{
    width:100%;
    height:240px;
    margin:16px 0 28px;
    border-radius:14px;
    overflow:hidden;
}

.cover-photo-public{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

body{margin:0;font-family:Inter,sans-serif;background:#f6f8fc;color:#1e293b}
.container{max-width:1100px;margin:auto;padding:30px 20px}
.card-media-link{display:block;text-decoration:none;color:inherit;cursor:pointer}
.card-media-link:focus-visible{outline:3px solid #2563eb;outline-offset:-3px}
.card-only-view{max-width:800px;padding:30px 20px}
.card-only-view #content{margin:0}
.card-only-view .card{width:100%}

.navbar{
    position:sticky;
    top:0;
    z-index:1000;
    width:100%;
    box-sizing:border-box;
    background:var(--theme-nav);
    color:var(--theme-nav-text);
    border-bottom:1px solid #e5e7eb;
    backdrop-filter:blur(10px);
}
.navbar-inner{
    max-width:1100px;
    margin:auto;
    min-height:56px;
    padding:0 20px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    box-sizing:border-box;
}
.navbar-brand{
    color:inherit !important;
    min-width:0;
    font-size:18px;
    font-weight:600;
    text-decoration:none;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.navbar-home{
    color:inherit !important;
    display:inline-flex;
    align-items:center;
    gap:7px;
    flex-shrink:0;
    padding:8px 12px;
    border-radius:8px;
    text-decoration:none;
    font-size:14px;
    font-weight:600;
}
.navbar-home:hover{background:rgba(128,128,128,.16)}
.navbar-home:focus-visible{outline:3px solid #2563eb;outline-offset:2px}
.navbar-menu-wrap{position:relative;flex-shrink:0}
.navbar-burger{
    width:40px;
    height:40px;
    padding:0;
    border:0;
    border-radius:8px;
    background:transparent;
    color:var(--theme-nav-text) !important;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:24px;
    line-height:1;
    cursor:pointer;
}
.navbar-burger:hover{background:rgba(128,128,128,.16)}
.navbar-burger:focus-visible{outline:3px solid #2563eb;outline-offset:2px}
.navbar-menu{
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    min-width:150px;
    padding:6px;
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:10px;
    box-shadow:0 10px 30px rgba(0,0,0,.14);
    display:none;
    z-index:1100;
}
.navbar-menu.open{display:block}
.navbar-menu a{
    display:block;
    padding:10px 12px;
    border-radius:7px;
    color:#1e293b !important;
    text-decoration:none;
    font-size:14px;
    font-weight:600;
}
.navbar-menu a:hover{background:#f1f5f9}
.navbar-menu-separator{height:1px;background:#e5e7eb;margin:6px 4px}
@media(prefers-color-scheme:dark){
    .navbar-menu{background:#1f2937;border-color:#374151}
    .navbar-menu a{color:#f3f4f6 !important}
    .navbar-menu a:hover{background:#374151}
    .navbar-menu-separator{background:#374151}
}
@media (max-width:600px){
    .navbar-inner{min-height:52px;padding:0 14px}
    .navbar-brand{font-size:16px}
    .navbar-home{padding:8px 10px}
}


h1{margin-bottom:6px}
.subtitle{color:#64748b;margin-bottom:30px}
.search{width:100%;padding:13px;border-radius:10px;border:1px solid #e2e8f0;margin-bottom:30px}
.navbar-search{
    margin-left:auto;
    width:min(280px,32vw);
    min-width:160px;
    height:36px;
    box-sizing:border-box;
    padding:7px 12px;
    border:1px solid rgba(127,127,127,.35);
    border-radius:8px;
    background:rgba(255,255,255,.92);
    color:#111827;
    outline:none;
    font:inherit;
}
.navbar-search:focus{
    border-color:#64748b;
    box-shadow:0 0 0 2px rgba(100,116,139,.18);
}
@media(max-width:600px){
    .navbar-search{width:150px;min-width:0}
}
@media(prefers-color-scheme:dark){
    .navbar-search{
        background:#1f2937;
        color:#f8fafc;
        border-color:#475569;
    }
    .navbar-search::placeholder{color:#94a3b8}
}
.weather-card{background:white;border-radius:16px;border:1px solid #e5e7eb;padding:20px;margin-bottom:24px}
.weather-card h3{margin:0 0 14px;font-size:16px;color:#1e293b}
.weather-days{display:flex;gap:12px;flex-wrap:wrap}
.weather-day{flex:1;min-width:120px;background:#f0f9ff;border-radius:12px;padding:12px;text-align:center}
.weather-day .wd-date{font-size:12px;font-weight:600;color:#64748b;margin-bottom:6px}
.weather-day .wd-icon{font-size:28px;margin-bottom:4px}
.weather-day .wd-temp{font-size:18px;font-weight:600;color:#1e293b}
.weather-day .wd-desc{font-size:12px;color:#64748b;margin-top:4px}
.weather-day .wd-rain{font-size:12px;color:#0369a1;margin-top:2px}
.weather-loading{color:#64748b;font-size:14px}
.weather-error{color:#ef4444;font-size:14px}
.food-section{margin-top:36px;margin-bottom:10px}
.food-section h3{font-size:22px;font-weight:600;margin:0 0 14px;color:#1e293b;border-left:4px solid #16a34a;padding-left:12px}
.food-tags{display:flex;flex-wrap:wrap;gap:10px}
.food-tag{background:#f0fdf4;border:1px solid #bbf7d0;color:#15803d;padding:8px 14px;border-radius:999px;font-size:14px;font-weight:500;text-decoration:none;transition:.2s}
.food-tag:hover{background:#dcfce7;border-color:#86efac}
.food-loading{color:#64748b;font-size:14px}
.food-error{color:#ef4444;font-size:14px}
.news-section{margin-top:36px}
.news-section h3{font-size:22px;font-weight:600;margin:0 0 14px;color:#1e293b;border-left:4px solid #2563eb;padding-left:12px}
.news-list{display:flex;flex-direction:column;gap:12px}
.news-item{background:white;border-radius:12px;border:1px solid #e5e7eb;padding:16px;transition:.2s}
.news-item:hover{box-shadow:0 4px 16px rgba(0,0,0,.07);transform:translateY(-2px)}
.news-item a{font-size:15px;font-weight:600;color:#1e293b;text-decoration:none;display:block;margin-bottom:4px}
.news-item a:hover{color:#2563eb}
.news-meta{font-size:12px;color:#94a3b8}
.news-loading{color:#64748b;font-size:14px;padding:12px 0}
.news-error{color:#ef4444;font-size:14px}

/* view */
.section-title{font-size:22px;font-weight:600;margin:36px 0 14px;color:#1e293b;border-left:4px solid #2563eb;padding-left:12px}
.section-title:first-child{margin-top:0}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(270px,1fr));gap:20px;margin-bottom:10px}
.card{background:white;border-radius:16px;border:1px solid #e5e7eb;overflow:hidden;transition:.25s}.expenses-card{margin-top:0}
.comparison-table-wrap{width:100%;overflow-x:auto;margin:0 0 10px}.comparison-table{width:100%;border-collapse:separate;border-spacing:0;font-size:14px;background:white;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden}.comparison-table th,.comparison-table td{border-right:1px solid #e5e7eb;border-bottom:1px solid #e5e7eb;padding:12px 14px;text-align:left;vertical-align:top;min-width:140px}.comparison-table th{font-weight:700;background:#f8fafc}.comparison-table th:last-child,.comparison-table td:last-child{border-right:0}.comparison-table tr:last-child td{border-bottom:0}.comparison-table .comparison-label-col{font-weight:600;min-width:170px}.comparison-empty{text-align:center;color:#64748b;font-weight:400}.comparison-table th{position:relative}.comparison-header-label{display:inline-block;vertical-align:middle;margin-right:5px}.table-sort-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:1px solid transparent;border-radius:5px;background:transparent;color:#64748b;font-size:12px;line-height:1;cursor:pointer;vertical-align:middle}
.table-photo-thumbs{display:flex;gap:6px;flex-wrap:wrap;align-items:center;max-width:220px}
.table-photo-thumb{width:56px;height:56px;flex:0 0 56px;overflow:hidden;border-radius:7px;background:#f1f5f9}
.table-photo-thumb img{display:block;width:100%;height:100%;object-fit:cover;cursor:pointer}
.table-photo-thumb img:hover{opacity:.88}.table-sort-btn:hover{background:#e2e8f0;color:#1e293b}.table-header-label{display:inline-block;vertical-align:middle;margin-right:5px}.table-sort-btn{flex-shrink:0}
.table-sort-btn.active{background:#dbeafe;color:#1d4ed8;border-color:#93c5fd}.container.public-view .table-sort-btn{color:#cbd5e1}.container.public-view .table-sort-btn:hover{background:#4b5563;color:#fff}.container.public-view .table-sort-btn.active{background:#1e40af;color:#fff;border-color:#60a5fa}.container.public-view .comparison-table{background:#1f2937;border-color:#4b5563;color:#e5e7eb}.container.public-view .comparison-table th{background:#374151;color:#f3f4f6;border-color:#4b5563}.container.public-view .comparison-table td{color:#e5e7eb;border-color:#4b5563}.container.public-view .comparison-empty{color:#9ca3af}.comparison-table-wrap{margin-top:0}
.homepage-table-card{margin-top:0}.expenses-card .card-body{padding:18px}.expense-home-total{font-weight:700;font-size:15px;margin:0 0 14px}.expense-home-table-wrap{width:100%;overflow-x:auto}.expense-home-table{width:100%;border-collapse:collapse;font-size:14px}.expense-home-table th,.expense-home-table td{border:1px solid #e5e7eb;padding:9px 10px;text-align:left;vertical-align:top}.expense-home-table th{font-weight:600;background:#f8fafc}.expense-home-empty{text-align:center;color:#64748b}.expense-monthly-trend{margin:0 0 18px;padding:14px 0 4px;border-top:1px solid #e5e7eb;border-bottom:1px solid #e5e7eb}.expense-monthly-trend-title{font-size:14px;font-weight:700;margin:0 0 8px}.expense-monthly-trend-scroll{width:100%;overflow-x:auto;overflow-y:hidden}.expense-monthly-trend svg{display:block;height:190px}.expense-monthly-trend .trend-grid{stroke:#e5e7eb;stroke-width:1}.expense-monthly-trend .trend-axis-label{fill:#64748b;font-size:11px}.expense-monthly-trend .trend-month-label{fill:#64748b;font-size:11px;text-anchor:middle}.expense-monthly-trend .trend-value-label{fill:#1e293b;font-size:11px;font-weight:600;text-anchor:middle}.expense-monthly-trend .trend-line{fill:none;stroke:#2563eb;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.expense-monthly-trend .trend-point{fill:#fff;stroke:#2563eb;stroke-width:2.5}.expense-monthly-trend .trend-no-data{padding:8px 0;color:#64748b;font-size:13px}@media(prefers-color-scheme:dark){.expense-monthly-trend{border-color:#374151}.expense-monthly-trend .trend-grid{stroke:#374151}.expense-monthly-trend .trend-axis-label,.expense-monthly-trend .trend-month-label{fill:#9ca3af}.expense-monthly-trend .trend-value-label{fill:#f3f4f6}.expense-monthly-trend .trend-line{stroke:#60a5fa}.expense-monthly-trend .trend-point{fill:#1f2937;stroke:#60a5fa}.expense-home-table th,.expense-home-table td{border-color:#374151}.expense-home-table th{background:#374151;color:#f3f4f6}.expenses-card{background:#1f2937;color:#e5e7eb}}
.card:hover{transform:translateY(-5px);box-shadow:0 15px 35px rgba(0,0,0,.08)}
.card img{width:100%;height:160px;object-fit:cover;background:#eee}
.card-body{padding:18px}
.title{font-size:18px;font-weight:600;margin-bottom:10px}
.distance{background:#e0f2fe;color:#0369a1;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:600;display:inline-block;margin-bottom:6px;margin-right:4px}
.field{font-size:15px;margin:6px 0}
.label{font-weight:600;color:#64748b}
.post-read-more{font-weight:600;color:#2563eb;white-space:nowrap}
.container.public-view .field a,
.container.card-only-view .field a{
  color:#2563eb;
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:2px;
}
.container.public-view .field a:hover,
.container.card-only-view .field a:hover{
  color:#1d4ed8;
}
.map-link{display:inline-block;margin-top:12px;color:#2563eb;text-decoration:none;font-size:13px;font-weight:600}
.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.btn{background:#2563eb;color:white;padding:8px 14px;border-radius:8px;text-decoration:none;font-size:14px}

/* editor */
.editor-table-block{box-sizing: border-box;width: 100%;background:white;border-radius:14px;border:1px solid #e5e7eb;padding:24px;margin-bottom:30px;overflow-x:visible}
.editor-table-move-controls{display:flex;align-items:center;gap:6px;margin-left:auto;flex:0 0 auto}
.editor-table-move-btn{width:34px;height:32px;padding:0;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#475569;font-size:17px;font-weight:700;line-height:1;cursor:pointer}
.editor-table-move-btn:hover:not(:disabled){background:#f8fafc;border-color:#94a3b8}
.editor-table-move-btn:disabled{opacity:.35;cursor:default}
@media(prefers-color-scheme:dark){.editor-table-move-btn{background:#1f2937;color:#d1d5db;border-color:#4b5563}.editor-table-move-btn:hover:not(:disabled){background:#374151;border-color:#6b7280}}

.editor-table-title{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
  width:100%;
  box-sizing:border-box;
  text-align:left;
}
.editor-table-title > input[type="text"]{
  width:100%;
  box-sizing:border-box;
  text-align:left;
  align-self:stretch;
}
.editor-table-move-controls{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:6px;
  margin:0 0 14px 0;
  flex:0 0 auto;
}
.editor-table-title > input[type="text"]{
  width:100%;
  box-sizing:border-box;
text-align:left;align-self:stretch;}
.editor-table-title input{font-size:17px;font-weight:600;border:none;border-bottom:2px solid #e2e8f0;outline:none;padding:4px 6px;flex:1;background:transparent}
.editor-table-title input:focus{border-bottom-color:#2563eb}
.table{width:100%;border-collapse:collapse}
.table th,.table td{border:1px solid #e5e7eb;padding:0;font-size:15px}
.row-controls button,.add,.save,.add-table-btn{min-height:40px;min-width:40px;font-size:16px}
.table tr{height:auto}
.row-controls button{padding:6px 10px;margin-right:4px}
.row-controls .delete-row-btn{margin-left:10px}
.add{background:#0ea5e9;color:white;border:none;padding:8px 14px;border-radius:8px;cursor:pointer;font-size:14px;margin-right:6px}
.save{margin-top:24px;background:#16a34a;color:white;border:none;padding:12px 20px;border-radius:8px;font-size:15px;cursor:pointer}
.notice{background:#dcfce7;padding:10px;border-radius:8px;margin-bottom:15px;color:#166534}
.preview-img{max-width:120px}
.add-table-btn{background:#7c3aed;color:white;border:none;padding:10px 16px;border-radius:8px;cursor:pointer;font-size:14px;margin-bottom:20px}
.duplicate-table-btn{background:#f8fafc;border:1px solid #cbd5e1;color:#475569;border-radius:8px;padding:7px 10px;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}.duplicate-table-btn:hover{background:#f1f5f9;border-color:#94a3b8}.delete-table-btn{background:none;border:none;color:#ef4444;font-size:20px;cursor:pointer;padding:0 4px;line-height:1}.table-template-picker{position:fixed;inset:0;background:rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;z-index:3000}.table-template-picker[hidden]{display:none}.table-template-dialog{background:white;border-radius:14px;padding:20px;min-width:260px;box-shadow:0 20px 50px rgba(0,0,0,.2)}.table-template-title{font-size:17px;font-weight:700;margin-bottom:12px}.table-template-dialog button{display:block;width:100%;margin:7px 0;padding:10px 12px;border:1px solid #e5e7eb;border-radius:8px;background:white;color:#1e293b;text-align:left;cursor:pointer;font-size:14px}.table-template-dialog button:hover{background:#f8fafc}.expense-total{margin-top:12px;text-align:right;font-weight:700;font-size:15px;padding:10px 4px;border-top:1px solid #e5e7eb}
@media(prefers-color-scheme:dark){.table-template-picker{background:rgba(0,0,0,.55)}.table-template-dialog{background:#1f2937;color:#f3f4f6;border:1px solid #374151;box-shadow:0 20px 50px rgba(0,0,0,.45)}.table-template-dialog button{background:#111827;color:#f3f4f6;border-color:#4b5563}.table-template-dialog button:hover{background:#374151;border-color:#64748b}}


/* quick table switching in Main Edit */
.editor-table-switcher{
  position:sticky;
  top:10px;
  z-index:1000;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  box-sizing:border-box;
  width:100%;
  margin:0 0 20px;
  padding:8px 10px;
  background:rgba(255,255,255,.96);
  border:1px solid #e5e7eb;
  border-radius:10px;
  box-shadow:0 4px 14px rgba(0,0,0,.08);
  backdrop-filter:blur(10px);
}
.editor-table-switcher-label{
  flex:0 0 auto;
  font-size:12px;
  font-weight:700;
  color:#64748b;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.editor-table-switcher-scroll{
  display:flex;
  align-items:center;
  gap:7px;
  min-width:0;
  overflow-x:auto;
  scrollbar-width:thin;
}
.editor-table-top-btn{
  flex:0 0 auto;
  min-height:34px;
  padding:6px 11px;
  border:1px solid #cbd5e1;
  border-radius:8px;
  background:#fff;
  color:#475569;
  font:600 13px/1.2 Inter,sans-serif;
  cursor:pointer;
  white-space:nowrap;
}
.editor-table-top-btn:hover{
  background:#f8fafc;
  border-color:#94a3b8;
}
.editor-table-switch-btn,.editor-table-switch-add{
  flex:0 0 auto;
  min-height:34px;
  padding:6px 11px;
  border:1px solid #cbd5e1;
  border-radius:8px;
  background:#fff;
  color:#475569;
  font:600 13px/1.2 Inter,sans-serif;
  cursor:pointer;
  white-space:nowrap;
}
.editor-table-switch-btn:hover,.editor-table-switch-add:hover{background:#f8fafc;border-color:#94a3b8}
.editor-table-switch-btn.active{background:#dbeafe;color:#1d4ed8;border-color:#93c5fd}
.editor-table-switch-add{color:#7c3aed;border-color:#c4b5fd}

.editor-table-position{
  flex:1 0 100%;
  min-width:0;
  display:flex;
  align-items:center;
  gap:9px;
  padding:1px 2px 0;
  color:#64748b;
  font:600 11px/1.2 Inter,sans-serif;
}
.editor-table-position-text{
  flex:0 0 auto;
  white-space:nowrap;
}
.editor-table-position-track{
  flex:1 1 auto;
  min-width:40px;
  height:3px;
  overflow:hidden;
  border-radius:999px;
  background:#e2e8f0;
}
.editor-table-position-progress{
  display:block;
  width:0%;
  height:100%;
  border-radius:inherit;
  background:#2563eb;
  transition:width .12s ease-out;
}

@media(max-width:600px){
  .editor-table-switcher{top:6px;padding:7px 8px;gap:8px}
  .editor-table-switcher-label{font-size:11px}
  .editor-table-top-btn,.editor-table-switch-btn,.editor-table-switch-add{min-height:32px;padding:6px 9px;font-size:12px}
}
@media(prefers-color-scheme:dark){
  .editor-table-switcher{background:rgba(31,41,55,.96);border-color:#374151;box-shadow:0 4px 14px rgba(0,0,0,.3)}
  .editor-table-switcher-label{color:#9ca3af}
  .editor-table-top-btn,.editor-table-switch-btn,.editor-table-switch-add{background:#111827;color:#d1d5db;border-color:#4b5563}
  .editor-table-top-btn:hover,.editor-table-switch-btn:hover,.editor-table-switch-add:hover{background:#374151;border-color:#64748b}
  .editor-table-switch-btn.active{background:#1e40af;color:#fff;border-color:#60a5fa}
  .editor-table-switch-add{color:#c4b5fd;border-color:#7c3aed}
  .editor-table-position{color:#9ca3af}
  .editor-table-position-track{background:#374151}
  .editor-table-position-progress{background:#60a5fa}
}

/* col drag/rename */
.col-header{cursor:grab;user-select:none;white-space:nowrap;position:relative;padding-right:32px!important}
.col-header.drag-over{background:#dbeafe;outline:2px dashed #2563eb}
.col-header.dragging{opacity:.4}
.col-drag-handle{margin-right:6px;color:#94a3b8;font-size:12px;cursor:grab}
.col-delete-btn{position:absolute;right:4px;top:50%;transform:translateY(-50%);background:none;border:none;color:#ef4444;cursor:pointer;font-size:14px;padding:0 3px;line-height:1;display:none}
.col-header:hover .col-delete-btn{display:inline}
@media(hover:none){.col-delete-btn{display:inline!important}}
.col-label{cursor:text;border-bottom:1px dashed transparent;padding-bottom:1px}
.col-label:hover{border-bottom-color:#94a3b8}
.col-rename-input{font-size:14px;font-weight:600;border:none;border-bottom:2px solid #2563eb;outline:none;background:transparent;width:80px;padding:0}
.editor-page-meta{background:white;border-radius:14px;border:1px solid #e5e7eb;padding:20px;margin-bottom:24px}
.editor-meta-row{display:flex;align-items:center;gap:12px;margin-bottom:10px}
.editor-meta-row:last-child{margin-bottom:0}
.editor-meta-row label{font-size:13px;font-weight:600;color:#64748b;width:80px;flex-shrink:0}
.editor-meta-row input{flex:1;font-size:15px;border:none;border-bottom:2px solid #e2e8f0;outline:none;padding:4px 6px;background:transparent}
.editor-meta-row select{flex:1;font-size:15px;border:1px solid #cbd5e1;border-radius:7px;outline:none;padding:8px 10px;background:white;color:#334155;box-sizing:border-box}
.editor-meta-row select:focus{border-color:#2563eb;box-shadow:0 0 0 1px #2563eb}
.editor-meta-row input:focus{border-bottom-color:#2563eb}
input.cell{width:100%;border:none;padding:12px 10px;font-size:16px;min-height:44px}

/* photo uploader */
.photo-cell{min-width:200px}
.photo-thumbs{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.photo-thumb{position:relative;width:84px;height:84px;border-radius:8px;overflow:hidden;border:1px solid #e5e7eb;flex-shrink:0}
.photo-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.photo-thumb .remove-photo{position:absolute;top:2px;right:2px;background:rgba(0,0,0,0.6);color:white;border:none;border-radius:50%;width:20px;height:20px;font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1;padding:0}
.photo-thumb .remove-photo:hover{background:rgba(239,68,68,0.9)}
.photo-thumb-uploading{background:#f1f5f9;display:flex;align-items:center;justify-content:center;font-size:11px;color:#64748b;flex-direction:column;gap:4px}
.photo-progress{width:60px;height:4px;background:#e2e8f0;border-radius:2px;overflow:hidden}
.photo-progress-bar{height:100%;background:#2563eb;border-radius:2px;transition:width .2s}
.add-photo-btn{background:#f8fafc;border:2px dashed #cbd5e1;color:#64748b;padding:8px 14px;border-radius:8px;cursor:pointer;font-size:13px;font-weight:500;transition:.2s}
.add-photo-btn:hover{border-color:#2563eb;color:#2563eb;background:#eff6ff}
.photo-hidden-input{display:none}

@media(max-width:700px){
  .editor-meta-row{flex-direction:column;align-items:stretch}
  .editor-meta-row label{width:auto;margin-bottom:4px}
  .editor-meta-row input{width:100%}
  .editor-table-title{align-items:stretch}
  .editor-table-block{padding:16px 14px;overflow-x:visible}
  input.cell{font-size:16px;padding:14px}
  .row-controls button{font-size:18px;padding:8px 12px}
}
.table tbody tr{background:white}
.table tbody tr+tr td{border-top:0}
.editorTable tbody tr {
  box-sizing: border-box;width: 100%;background: #f3f4f6 !important;
}

.editorTable tbody tr:hover {
  background: #f3f4f6 !important;
}
.editor-table-block{-webkit-overflow-scrolling:touch}
.photo-thumb{
  transition: all .25s ease;
}
.photo-thumb.dragging{
  opacity:.4;
  transform:scale(.95);
}

.photo-thumb.drag-over{
  outline:2px dashed #2563eb;
}

/* Document attachments in the post/gallery area */
.card-document-attachments{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 8px;}
.card-document-attachment{
  display:flex;
  align-items:center;
  gap:10px;
  width:min(100%,420px);
  box-sizing:border-box;
  padding:10px 12px;
  margin:0 0 8px;
  border:1px solid #dbe2ea;
  border-radius:10px;
  background:#f8fafc;
  color:#1e293b;
  text-decoration:none;
}
.card-document-attachment:hover{background:#f1f5f9;border-color:#94a3b8}
.card-document-icon{font-size:28px;line-height:1;flex:0 0 auto}
.card-document-info{display:flex;flex-direction:column;min-width:0;text-align:left}
.card-document-name{font-weight:600;overflow-wrap:anywhere}
.card-document-type{font-size:12px;color:#64748b;margin-top:2px}
@media(prefers-color-scheme:dark){
  .card-document-attachment{background:#111827;border-color:#4b5563;color:#f3f4f6}
  .card-document-attachment:hover{background:#1f2937;border-color:#6b7280}
  .card-document-type{color:#9ca3af}
}

/* Public-page text zoom */
.public-view { --text-scale:1; }
.public-view h1 { font-size:calc(2em * var(--text-scale)); }
.public-view .subtitle { font-size:calc(1em * var(--text-scale)); }
.public-view .search { font-size:calc(16px * var(--text-scale)); }
.public-view .section-title { font-size:calc(22px * var(--text-scale)); }
.public-view .title { font-size:calc(18px * var(--text-scale)); }
.public-view .field { font-size:calc(14px * var(--text-scale)); }
.public-view .distance { font-size:calc(12px * var(--text-scale)); }
.public-view .weather-card h3 { font-size:calc(16px * var(--text-scale)); }
.public-view .weather-day .wd-date, .public-view .weather-day .wd-desc, .public-view .weather-day .wd-rain { font-size:calc(12px * var(--text-scale)); }
.public-view .weather-day .wd-temp { font-size:calc(18px * var(--text-scale)); }
.public-view .weather-day .wd-icon { font-size:calc(28px * var(--text-scale)); }
.public-view .food-section h3, .public-view .news-section h3 { font-size:calc(22px * var(--text-scale)); }
.public-view .food-tag { font-size:calc(14px * var(--text-scale)); }
.public-view .news-item a { font-size:calc(15px * var(--text-scale)); }
.public-view .news-meta { font-size:calc(12px * var(--text-scale)); }
.card { cursor:pointer; }
.card button, .card a, .card input, .card textarea, .card select { cursor:default; }
.card-edit-btn { margin-top:12px; padding:7px 12px; border:1px solid #d1d5db; border-radius:7px; background:#fff; color:#334155; font-size:14px; cursor:pointer; }
.card-edit-btn:hover { background:#f8fafc; }
.card-edit-modal { position:fixed; inset:0; z-index:6000; display:none; align-items:center; justify-content:center; padding:20px; background:rgba(15,23,42,.45); }
.add-row-modal{position:fixed;inset:0;z-index:6000;display:none;align-items:center;justify-content:center;padding:20px;background:rgba(15,23,42,.45)}
.add-row-modal.open{display:flex}
.add-row-dialog{box-sizing:border-box;width:min(560px,100%);max-height:90vh;overflow:auto;background:#fff;border-radius:14px;padding:20px;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.add-row-dialog h2{margin:0 0 16px;font-size:20px}
.add-row-field{margin-bottom:14px}
.add-row-field label{display:block;margin-bottom:6px;font-size:13px;font-weight:600;color:#475569}
.add-row-field input,
.add-row-field textarea,
.add-row-field select{
    width:100%;
    box-sizing:border-box;
    padding:9px 10px;
    border:1px solid #cbd5e1;
    border-radius:7px;
    font:inherit;
    background:#fff;
    color:#1e293b;
}
.add-row-field textarea{min-height:90px;resize:vertical}
.add-row-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
.add-row-actions button{padding:9px 14px;border:1px solid #cbd5e1;border-radius:7px;cursor:pointer}
@media(prefers-color-scheme:dark){
  .add-row-dialog{background:#1f2937;color:#e5e7eb;border:1px solid #374151}
  .add-row-field label{color:#d1d5db}
  .add-row-field input,
.add-row-field textarea,
.add-row-field select{
    background:#111827;
    color:#f3f4f6;
    border-color:#4b5563;
}
}

.card-edit-dialog {box-sizing: border-box;width: min(560px, 100%);overflow-x: hidden;width:min(560px,100%); max-height:90vh; overflow:auto; background:#fff; border-radius:14px; padding:20px; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.card-edit-dialog * {
  box-sizing: border-box;
}
.card-edit-dialog h2 { margin:0 0 16px; font-size:20px; }
.card-edit-field { margin-bottom:14px; }
.card-edit-field label { display:block; margin-bottom:6px; font-size:13px; font-weight:600; color:#475569; }
.card-edit-field input,.card-edit-field textarea,.card-edit-field select { width:100%; max-width:100%;padding:9px 10px; border:1px solid #cbd5e1; border-radius:7px; font:inherit; background:#fff; color:#1e293b; }
.card-edit-field textarea { min-height:90px; resize:vertical; }
.card-edit-move-field { margin-top:20px; padding-top:16px; border-top:1px solid #e5e7eb; }
.card-edit-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.card-edit-actions button { padding:9px 14px; border:1px solid #cbd5e1; border-radius:7px; cursor:pointer; }
.card-edit-actions .save { background:#1e293b; color:#fff; border-color:#1e293b; }
.zoom-controls { position:fixed; right:20px; bottom:24px; z-index:5000; display:flex; flex-direction:column; gap:6px; padding:6px; background:rgba(255,255,255,.94); border:1px solid #e2e8f0; border-radius:12px; box-shadow:0 6px 20px rgba(0,0,0,.12); }
.zoom-controls button { width:42px; height:42px; border:1px solid #e2e8f0; border-radius:8px; background:white; color:#1e293b; font-size:22px; line-height:1; cursor:pointer; }
.zoom-controls .zoom-level { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); pointer-events:none; font-size:9px; line-height:1; font-weight:600; color:#64748b; background:rgba(255,255,255,.9); padding:2px 3px; border-radius:3px; white-space:nowrap; }
.zoom-controls button:hover { background:#f8fafc; }
.zoom-controls button:focus-visible { outline:2px solid #2563eb; outline-offset:2px; }
@media(max-width:700px){ .zoom-controls { right:12px; bottom:16px; } .zoom-controls button { width:44px; height:44px; } }

/* ── Editor dark theme: follows the browser/OS color scheme ── */
@media (prefers-color-scheme: dark) {
  body:not(.theme-enabled):has(.editor-page-meta) {
    background:#111827;
    color:#e5e7eb;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .editor-page-meta,
  body:not(.theme-enabled):has(.editor-page-meta) .editor-table-block {
    background:#1f2937;
    border-color:#374151;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .editor-meta-row label,
  body:not(.theme-enabled):has(.editor-page-meta) .editor-table-title label {
    color:#9ca3af;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .editor-meta-row input,
   body:not(.theme-enabled):has(.editor-page-meta) .editor-meta-row select,
  body:not(.theme-enabled):has(.editor-page-meta) .editor-table-title input,
  body:not(.theme-enabled):has(.editor-page-meta) input.cell,
  body:not(.theme-enabled):has(.editor-page-meta) textarea.cell {
    color:#f3f4f6;
    background:#111827;
    border-color:#4b5563;
  }

  body:not(.theme-enabled):has(.editor-page-meta) input::placeholder,
  body:not(.theme-enabled):has(.editor-page-meta) textarea::placeholder {
    color:#9ca3af;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .cover-editor,
  body:not(.theme-enabled):has(.editor-page-meta) .field-reorder-list {
    background:#111827;
    border-color:#374151;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .cover-editor-label,
  body:not(.theme-enabled):has(.editor-page-meta) .field-reorder-label {
    color:#d1d5db;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .field-reorder-toggle,
  body:not(.theme-enabled):has(.editor-page-meta) .field-reorder-item,
  body:not(.theme-enabled):has(.editor-page-meta) .cover-upload-btn,
  body:not(.theme-enabled):has(.editor-page-meta) .add-photo-btn,
  body:not(.theme-enabled):has(.editor-page-meta) .newline-btn {
    background:#1f2937;
    color:#e5e7eb;
    border-color:#4b5563;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .editorTable tbody tr {
    background:#374151 !important;
    border-color:#4b5563;
    box-shadow:0 2px 8px rgba(0,0,0,.25);
  }

  body:not(.theme-enabled):has(.editor-page-meta) .editorTable .row-controls {
    border-top-color:#4b5563;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .field-reorder-item.drag-over {
    background:#1e3a5f;
    border-color:#60a5fa;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .editorTable tbody td:not(.row-controls)::before {
    color:#d1d5db;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .notice {
    background:#14532d;
    color:#dcfce7;
  }

  body:not(.theme-enabled):has(.editor-page-meta) .table tbody tr+tr td {
    border-top-color:#111827;
  }
}


/* ── Dark theme for public index + individual card ──
   Follows browser/OS preference. Editor remains dark via its existing rules. */
@media (prefers-color-scheme: dark) {
  body {
    background:#111827;
    color:#e5e7eb;
  }

  .container.public-view,
  .container.card-only-view {
    color:#e5e7eb;
  }

  .container.public-view .subtitle,
  .container.public-view .field,
  .container.card-only-view .field {
    color:#d1d5db;
  }

  .container.public-view .card,
  .container.card-only-view .card,
  .container.public-view .weather-card,
  .container.public-view .news-item {
    background:#1f2937;
    border-color:#374151;
    color:#e5e7eb;
  }

  .container.public-view .card-body,
  .container.card-only-view .card-body {
    color:#e5e7eb;
  }

  .container.public-view .title,
  .container.card-only-view .title,
  .container.public-view .section-title,
  .container.public-view .weather-card h3,
  .container.public-view .news-section h3 {
    color:#f3f4f6;
  }

  .container.public-view .label,
  .container.card-only-view .label,
  .container.public-view .weather-day .wd-date,
  .container.public-view .weather-day .wd-desc,
  .container.public-view .weather-loading,
  .container.public-view .food-loading,
  .container.public-view .news-loading,
  .container.public-view .news-meta {
    color:#9ca3af;
  }

  .container.public-view .search {
    background:#1f2937;
    color:#f3f4f6;
    border-color:#4b5563;
  }

  .container.public-view .search::placeholder {
    color:#9ca3af;
  }
  .container.public-view .expenses-card .expense-home-table th {
    background:#374151;
    color:#f3f4f6;
    border-color:#4b5563;
  }
  .container.public-view .expenses-card .expense-home-table td {
    color:#e5e7eb;
    border-color:#4b5563;
  }
  .container.public-view .expenses-card .expense-home-table {
    color:#e5e7eb;
  }
  .container.public-view .expenses-card .expense-home-empty {
    color:#9ca3af;
  }


  .container.public-view .weather-day {
    background:#172554;
  }

  .container.public-view .food-tag {
    background:#052e16;
    border-color:#166534;
    color:#86efac;
  }

  .container.public-view .food-tag:hover {
    background:#14532d;
    border-color:#22c55e;
  }

  .container.public-view .news-item a {
    color:#e5e7eb;
  }

  .container.public-view .news-item a:hover {
    color:#60a5fa;
  }

  .container.public-view .field a,
  .container.card-only-view .field a{
    color:#60a5fa;
  }

  .container.public-view .field a:hover,
  .container.card-only-view .field a:hover{
    color:#93c5fd;
  }

  .container.public-view .map-link {
    color:#60a5fa;
  }

  .container.public-view .card-photo-load-more {
    background:#1f2937;
    color:#e5e7eb;
    border-color:#4b5563;
  }

  .container.public-view .card-photo-load-more:hover {
    background:#374151;
    border-color:#6b7280;
  }

  .container.card-only-view .card-edit-btn {
    background:#1f2937;
    color:#e5e7eb;
    border-color:#4b5563;
  }

  .container.card-only-view .card-edit-btn:hover {
    background:#374151;
  }

  /* Card edit popup follows the browser/OS dark theme. */
  .card-edit-modal {
    background:rgba(0,0,0,.68);
  }

  .card-edit-dialog {
    background:#1f2937;
    color:#e5e7eb;
    border:1px solid #374151;
  }

  .card-edit-dialog h2 {
    color:#f3f4f6;
  }

  .card-edit-field label {
    color:#d1d5db;
  }

  .card-edit-field input,
  .card-edit-field textarea,
  .card-edit-field select {
    background:#111827;
    color:#f3f4f6;
    border-color:#4b5563;
  }

  .card-edit-field input::placeholder,
  .card-edit-field textarea::placeholder {
    color:#9ca3af;
  }

  .card-edit-actions button {
    background:#1f2937;
    color:#e5e7eb;
    border-color:#4b5563;
  }

  .card-edit-actions .save {
    background:#e5e7eb;
    color:#111827;
    border-color:#e5e7eb;
  }

  .card-edit-dialog .add-photo-btn {
    background:#1f2937;
    color:#e5e7eb;
    border-color:#4b5563;
  }

  .card-edit-dialog .add-photo-btn:hover {
    background:#374151;
    border-color:#6b7280;
    color:#f3f4f6;
  }

  .card-edit-dialog .photo-thumb {
    border-color:#4b5563;
  }

  .card-edit-dialog .photo-thumb-uploading {
    background:#111827;
    color:#9ca3af;
  }

  .card-edit-dialog .photo-progress {
    background:#374151;
  }
}


@media (prefers-color-scheme: dark) {
  #resizeBeforeUpload,
  #resizeBeforeUpload + label {
    color-scheme: dark;
  }

  #resizeBeforeUpload {
    accent-color: #60a5fa;
  }

  #resizeBeforeUpload,
  #resizeMax {
    background: #1f2937 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
  }

  #resizeMax {
    border: 1px solid #475569 !important;
    border-radius: 6px;
  }

  label[for="resizeBeforeUpload"] {
    color: #e5e7eb !important;
  }
}

@media (prefers-color-scheme: dark) {
  #resizeBeforeUpload {
    accent-color: #60a5fa;
  }

  #resizeBeforeUpload ~ * {
    color: #e5e7eb;
  }

  #resizeBeforeUpload {
    color-scheme: dark;
  }

  #resizeMax {
    color-scheme: dark;
  }
}

@media (prefers-color-scheme: dark) {
  div:has(> label > #resizeBeforeUpload) {
    background: #111827 !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
  }

  div:has(> label > #resizeBeforeUpload) label {
    color: #e5e7eb !important;
  }

  div:has(> label > #resizeBeforeUpload) #resizeMax {
    background: #1f2937 !important;
    color: #f8fafc !important;
    border: 1px solid #475569 !important;
  }
}


.navbar-search {
    margin-left:auto;
    width:min(280px, 32vw);
    min-width:160px;
    height:36px;
    box-sizing:border-box;
    padding:7px 12px;
    border:1px solid rgba(127,127,127,.35);
    border-radius:8px;
    background:rgba(255,255,255,.92);
    color:#111827;
    outline:none;
    font:inherit;
}
.navbar-search:focus {
    border-color:#64748b;
    box-shadow:0 0 0 2px rgba(100,116,139,.18);
}
@media (max-width:600px) {
    .navbar-search {
        width:150px;
        min-width:0;
    }
}
@media (prefers-color-scheme: dark) {
    .navbar-search {
        background:#1f2937;
        color:#f8fafc;
        border-color:#475569;
    }
    .navbar-search::placeholder {
        color:#94a3b8;
    }
}


/* Column header dark-theme compatibility */
body:has(.editor-page-meta) .editorTable thead th.col-header {
    background:#1f2937;
    border-color:#374151;
    color:#f3f4f6;
}
body:has(.editor-page-meta) .editorTable thead th.col-header .col-drag-handle {
    color:#9ca3af;
}
body:has(.editor-page-meta) .editorTable thead th.col-header .col-delete-btn {
    color:#f87171;
}
body:has(.editor-page-meta) .editorTable thead th.col-header .col-delete-btn:hover {
    color:#fca5a5;
}


.photo-drop-zone{
  width:100%;
  min-height:64px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
  box-sizing:border-box;
  border:2px dashed #cbd5e1;
  border-radius:10px;
  background:#f8fafc;
  color:#334155;
  cursor:pointer;
  padding:10px 14px;
}
.photo-drop-zone:hover,
.photo-drop-zone.drag-over{
  border-color:#0ea5e9;
  background:#f0f9ff;
}
.photo-drop-title{font-size:14px;font-weight:600}
.photo-drop-hint{font-size:12px;font-weight:400;color:#64748b}
body:has(.editor-page-meta) .photo-drop-zone{
  background:#111827;
  border-color:#4b5563;
  color:#f3f4f6;
}
body:has(.editor-page-meta) .photo-drop-zone:hover,
body:has(.editor-page-meta) .photo-drop-zone.drag-over{
  border-color:#38bdf8;
  background:#172554;
}
body:has(.editor-page-meta) .photo-drop-hint{color:#9ca3af}

.table-type-filter{display:flex;align-items:center;gap:8px;margin:0 0 12px;padding:0 2px;}
.table-type-filter label{font-size:14px;font-weight:600;color:#475569;}
.table-type-filter select{min-width:150px;padding:7px 30px 7px 10px;border:1px solid #d1d5db;border-radius:8px;background:#fff;color:#1f2937;font:inherit;cursor:pointer;}
 .expense-home-table tbody tr.expense-month-row td{
  padding:10px 12px 8px !important;
  background:#a0a0a0 !important;
  border-top:2px solid #e2e8f0 !important;
  border-bottom:1px solid #e5e7eb !important;
  font-size:13px !important;
  font-weight:700 !important;
  letter-spacing:.02em;
  color:#334155 !important;
}

@media (max-width:600px){.table-type-filter{align-items:flex-start;flex-direction:column;gap:5px}.table-type-filter select{width:100%;}}

.index-category{margin-top:30px}
.index-category:first-of-type{margin-top:24px}
.index-category-title{font-size:20px;font-weight:600;margin:0 0 12px;color:#1e293b;border-left:4px solid #2563eb;padding-left:12px}
.index-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(270px,1fr));gap:16px;margin-top:0}

.index-item{display:flex;align-items:center;gap:16px;background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:16px 18px;color:#1e293b;transition:.2s}
.index-item:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(0,0,0,.08)}
.index-item-main{display:flex;align-items:center;gap:16px;min-width:0;flex:1;text-decoration:none;color:inherit}
.index-item-icon{width:64px;height:64px;flex:0 0 64px;display:flex;align-items:center;justify-content:center;overflow:hidden}
.index-item-icon > svg{display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain}
.index-item-content{min-width:0;flex:1}
.index-item-title{font-size:18px;font-weight:600;margin-bottom:6px}
.index-item-subtitle{font-size:14px;color:#64748b}
.index-item-status{display:inline-flex;align-items:center;margin-top:8px;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:700;line-height:1.2}
/* Public: Vibrant emerald tag */
.index-item-status.is-public {
  background-color: #d1fae5;
  color: #065f46;
}

/* Private: Warm, readable amber-rose tag */
.index-item-status.is-private {
  background-color: #ffe4e6;
  color: #9f1239;
}.index-item-edit{width:36px;height:36px;flex:0 0 36px;display:flex;align-items:center;justify-content:center;border-radius:8px;text-decoration:none;font-size:22px;color:#64748b;transition:.15s}
.index-item-edit:hover{background:#f1f5f9;color:#1e293b}
@media(max-width:600px){
  .index-item{gap:10px;padding:14px 12px}
  .index-item-main{gap:12px}
  .index-item-icon{width:56px;height:56px;flex-basis:56px}
  .index-item-edit{width:34px;height:34px;flex-basis:34px}
}
@media(max-width:600px){
  .index-item{gap:12px;padding:14px 16px}
  .index-item-icon{width:56px;height:56px;flex-basis:56px}
}
@media(prefers-color-scheme:dark){.index-item{background:#1f2937;border-color:#374151;color:#f3f4f6}.index-item-subtitle{color:#9ca3af}.index-category-title{color:#f3f4f6}}

/* Dark theme for Task select menus */
@media (prefers-color-scheme: dark) {
  select,
  select.cell,
  .editor-table-block select,
  .card-editor-modal select {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
    border-color: #4b5563 !important;
    color-scheme: dark;
  }

  select option {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
  }
}

/* Task select controls: match the other editor fields */
select.cell,
.add-row-field select,
.card-edit-field select {
  width:100%;
  box-sizing:border-box;
  min-height:44px;
  padding:10px 36px 10px 10px;
  border:1px solid #cbd5e1;
  border-radius:7px;
  font:inherit;
  background-color:#fff;
  color:#1e293b;
  cursor:pointer;
}
select.cell:focus,
.add-row-field select:focus,
.card-edit-field select:focus {
  outline:none;
  border-color:#2563eb;
  box-shadow:0 0 0 2px rgba(37,99,235,.12);
}
@media(prefers-color-scheme:dark){
  select.cell,
  .add-row-field select,
  .card-edit-field select {
    background-color:#111827 !important;
    color:#f3f4f6 !important;
    border-color:#4b5563 !important;
    color-scheme:dark;
  }
  select.cell option,
  .add-row-field select option,
  .card-edit-field select option {
    background-color:#111827 !important;
    color:#f3f4f6 !important;
  }
}

.youtube-thumbnail-link{
  display:block;
  width:min(100%,360px);
  margin:8px 0 10px;
  text-decoration:none;
  color:inherit;
}
.youtube-thumbnail-wrap{
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:16/9;
  overflow:hidden;
  border-radius:10px;
  background:#e5e7eb;
}
.youtube-thumbnail{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}
.youtube-play-button{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:48px;
  height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:9px;
  background:rgba(0,0,0,.72);
  color:#fff;
  font-size:18px;
  line-height:1;
}
.youtube-thumbnail-label{
  display:block;
  margin-top:5px;
  font-size:12px;
  color:#64748b;
}
@media(prefers-color-scheme:dark){
  .youtube-thumbnail-wrap{background:#1f2937}
  .youtube-thumbnail-label{color:#94a3b8}
}

/* ── Selected Pocketlist theme ─────────────────────────── */
body.theme-enabled {
    background:var(--theme-background) !important;
    color:var(--theme-text);
}
body.theme-enabled .container { color:var(--theme-text); }
body.theme-enabled .container.public-view .subtitle,
body.theme-enabled .container.public-view .label,
body.theme-enabled .container.card-only-view .label,
body.theme-enabled .subtitle { color:var(--theme-muted); }

body.theme-enabled .card,
body.theme-enabled .weather-card,
body.theme-enabled .news-item,
body.theme-enabled .index-item {
    background:var(--theme-surface) !important;
    color:var(--theme-text);
    border-color:var(--theme-border) !important;
}
body.theme-enabled .card-body,
body.theme-enabled .card .field,
body.theme-enabled .weather-card h3,
body.theme-enabled .news-section h3,
body.theme-enabled .food-section h3,
body.theme-enabled .index-item-title,
body.theme-enabled .index-item-content,
body.theme-enabled .title,
body.theme-enabled .section-title { color:var(--theme-text); }

body.theme-enabled .field a,
body.theme-enabled .map-link,
body.theme-enabled .news-item a,
body.theme-enabled a { color:var(--theme-accent); }
body.theme-enabled .field a:hover,
body.theme-enabled .map-link:hover,
body.theme-enabled .news-item a:hover,
body.theme-enabled a:hover { color:var(--theme-accent); }

body.theme-enabled .search,
body.theme-enabled .navbar-search,
body.theme-enabled input,
body.theme-enabled textarea,
body.theme-enabled select,
body.theme-enabled select.cell,
body.theme-enabled .editor-page-meta input,
body.theme-enabled .editor-page-meta select,
body.theme-enabled .editor-table-block input.cell,
body.theme-enabled .editor-table-block textarea.cell {
    background:var(--theme-input) !important;
    color:var(--theme-text) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled input::placeholder,
body.theme-enabled textarea::placeholder,
body.theme-enabled .navbar-search::placeholder { color:var(--theme-muted) !important; }

body.theme-enabled .navbar {
    background:var(--theme-nav) !important;
    color:var(--theme-nav-text) !important;
    border-bottom-color:var(--theme-border);
}
body.theme-enabled .navbar-burger,
body.theme-enabled .navbar-brand,
body.theme-enabled .navbar-home { color:var(--theme-nav-text) !important; }
body.theme-enabled .navbar-menu {
    background:var(--theme-surface) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled .navbar-menu a { color:var(--theme-text) !important; }
body.theme-enabled .navbar-menu a:hover { background:var(--theme-surface-alt) !important; }
body.theme-enabled .navbar-menu-separator { background:var(--theme-border) !important; }

body.theme-enabled .card-photo-load-more,
body.theme-enabled .photo-drop-zone,
body.theme-enabled .newline-btn,
body.theme-enabled .cover-upload-btn,
body.theme-enabled .field-reorder-toggle,
body.theme-enabled .field-reorder-item {
    background:var(--theme-surface-alt) !important;
    color:var(--theme-text) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled .card-photo-load-more:hover,
body.theme-enabled .photo-drop-zone:hover,
body.theme-enabled .photo-drop-zone.drag-over,
body.theme-enabled .cover-upload-btn:hover,
body.theme-enabled .newline-btn:hover { background:var(--theme-surface) !important; }

body.theme-enabled .weather-day { background:var(--theme-surface-alt) !important; }
body.theme-enabled .weather-day .wd-date,
body.theme-enabled .weather-day .wd-desc,
body.theme-enabled .weather-loading,
body.theme-enabled .food-loading,
body.theme-enabled .news-loading,
body.theme-enabled .news-meta { color:var(--theme-muted); }

body.theme-enabled .food-tag {
    background:var(--theme-surface-alt) !important;
    border-color:var(--theme-border) !important;
    color:var(--theme-accent) !important;
}
body.theme-enabled .food-tag:hover {
    background:var(--theme-surface) !important;
    border-color:var(--theme-accent) !important;
}

body.theme-enabled .editor-page-meta,
body.theme-enabled .editor-table-block,
body.theme-enabled .cover-editor,
body.theme-enabled .field-reorder-list { color:var(--theme-text); }
body.theme-enabled .editor-table-title input,
body.theme-enabled .editor-page-meta input,
body.theme-enabled .editor-page-meta select {
    background:var(--theme-input);
    color:var(--theme-text);
}
body.theme-enabled .editorTable tbody tr {
    background:var(--theme-surface) !important;
    color:var(--theme-text) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled .editorTable tbody tr:hover {
    background:var(--theme-surface) !important;
}
body.theme-enabled .editorTable tbody td {
    color:var(--theme-text) !important;
}
body.theme-enabled .editorTable tbody td:not(.row-controls)::before {
    color:var(--theme-muted) !important;
}
body.theme-enabled .editorTable .row-controls {
    border-top-color:var(--theme-border) !important;
}
body.theme-enabled .editorTable thead th.col-header {
    background:var(--theme-surface-alt) !important;
    color:var(--theme-text) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled .editorTable td,
body.theme-enabled .editorTable th { border-color:var(--theme-border) !important; }
body.theme-enabled .editorTable thead th,
body.theme-enabled .editorTable thead th.col-header {
    background:var(--theme-surface-alt) !important;
    color:var(--theme-text) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled .editor-table-title span,
body.theme-enabled .editor-table-title label,
body.theme-enabled .editor-meta-row > label,
body.theme-enabled .cover-editor-label,
body.theme-enabled .field-reorder-label { color:var(--theme-muted) !important; }

body.theme-enabled .notice {
    background:var(--theme-surface-alt);
    color:var(--theme-text);
    border-color:var(--theme-border);
}
body.theme-enabled .save {
    background:var(--theme-accent) !important;
    color:var(--theme-accent-contrast) !important;
}
body.theme-enabled .add,
body.theme-enabled .add-table-btn,
body.theme-enabled .add-photo-btn,
body.theme-enabled .add-row-modal button,
body.theme-enabled .card-edit-actions button {
    background:var(--theme-surface-alt);
    color:var(--theme-text);
    border-color:var(--theme-border);
}
body.theme-enabled .add:hover,
body.theme-enabled .add-table-btn:hover,
body.theme-enabled .add-photo-btn:hover { background:var(--theme-surface) !important; }
body.theme-enabled :focus-visible { outline-color:var(--theme-accent) !important; }
body.theme-enabled .editor-table-block.table-selected { outline-color:var(--theme-accent) !important; }

body.theme-enabled .photo-placeholder {
    background:var(--theme-surface-alt);
    color:var(--theme-muted);
}
body.theme-enabled .youtube-thumbnail-wrap { background:var(--theme-surface-alt); }
body.theme-enabled .youtube-thumbnail-label { color:var(--theme-muted); }
body.theme-enabled .index-category-title {
    color:var(--theme-text);
    border-left-color:var(--theme-accent);
}
body.theme-enabled .index-item-subtitle { color:var(--theme-muted); }
body.theme-enabled .index-item:hover { box-shadow:0 8px 24px rgba(0,0,0,.12); }

body.theme-enabled #resizeBeforeUpload,
body.theme-enabled #resizeMax {
    background:var(--theme-input) !important;
    color:var(--theme-text) !important;
    border-color:var(--theme-border) !important;
}
body.theme-enabled .photo-modal-control {
    background:var(--theme-surface) !important;
    color:var(--theme-text) !important;
}
body.theme-enabled .photo-modal-control:hover { background:var(--theme-surface-alt) !important; }
/* Selected Pocketlist themes always take precedence over OS dark mode. */
body.theme-enabled,
body.theme-enabled .container,
body.theme-enabled .public-view,
body.theme-enabled .card-only-view {
  background-color:var(--theme-background) !important;
  color:var(--theme-text) !important;
}
body.theme-enabled .index-list,
body.theme-enabled .index-category,
body.theme-enabled .editor-page-meta,
body.theme-enabled .editor-table-block,
body.theme-enabled .cover-editor,
body.theme-enabled .field-reorder-list {
  color:var(--theme-text) !important;
}
body.theme-enabled .index-item {
  background:var(--theme-surface) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}
body.theme-enabled .index-item-title,
body.theme-enabled .index-category-title,
body.theme-enabled .editor-page-meta label,
body.theme-enabled .editor-table-title label {
  color:var(--theme-text) !important;
}
body.theme-enabled .index-item-subtitle,
body.theme-enabled .editor-meta-row > label,
body.theme-enabled .cover-editor-label,
body.theme-enabled .field-reorder-label {
  color:var(--theme-muted) !important;
}
body.theme-enabled .editor-page-meta,
body.theme-enabled .cover-editor,
body.theme-enabled .editor-table-block,
body.theme-enabled .field-reorder-list {
  background:var(--theme-surface) !important;
  border-color:var(--theme-border) !important;
}

/* The selected theme replaces OS dark-mode presentation. */

/* Keep the normal Save button itself visible while scrolling while scrolling. */
#saveBtn{
  position:fixed !important;
  right:20px;
  bottom:20px;
  z-index:9999;
  margin:0 !important;
  box-shadow:0 3px 12px rgba(0,0,0,.22);
}
#floatAddRow{
  position:fixed;
  right:20px;
  bottom:72px;
  z-index:9999;
  margin:0 !important;
  box-shadow:0 3px 12px rgba(0,0,0,.22);
}
.editor-table-block.table-selected{
  outline:2px solid #2563eb;
  outline-offset:2px;
}
@media(max-width:600px){
  #floatAddRow{
    right:12px;
    bottom:64px;
  }
}

@media (max-width:600px){
  #saveBtn{
    right:12px;
    bottom:12px;
  }
}

/* Field reorder control */
.field-reorder-panel {
  margin:0 0 12px;
}
.field-reorder-toggle {
  border:1px solid #cbd5e1;
  background:#fff;
  color:#334155;
  border-radius:8px;
  padding:8px 12px;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
}
.field-reorder-toggle:hover {
  background:#f8fafc;
}
.field-reorder-list {
  width:min(420px,100%);
  margin-top:8px;
  padding:6px;
  background:#f8fafc;
  border:1px solid #dbe3ec;
  border-radius:10px;
}
.field-reorder-item {
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 10px;
  margin:3px 0;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:7px;
  cursor:grab;
  user-select:none;
}
.field-reorder-item.dragging {
  opacity:.45;
}
.field-reorder-item.drag-over {
  border-color:#2563eb;
  background:#eff6ff;
}
.field-reorder-handle {
  color:#64748b;
  font-size:16px;
}
.field-reorder-label {
  font-weight:600;
  font-size:13px;
  color:#334155;
}

/* Form-style table editor */
.editorTable {
  display:block;
  width:100%;
  border:0;
  overflow:visible;
}
.editorTable thead {
  display:flex;
  margin-bottom:12px;
}
.editorTable thead tr {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  width:100%;
}
.editorTable thead th.col-header {
  flex:0 0 auto;
  padding:7px 10px;
  border:1px solid #dbe3ec;
  border-radius:8px;
  background:#f8fafc;
  font-size:13px;
}
.editorTable thead th:last-child {
  display:none;
}
.editorTable tbody {
  display:block;
}
.editorTable tbody tr {
  display:block;
  width:100%;
  margin:0 0 30px;
  padding:18px;
  background:#fff;
  border:1px solid #dbe3ec;
  border-radius:12px;
  box-shadow:0 2px 8px rgba(15,23,42,.06);
}
.editorTable tbody td {
  display:block;
  width:100% !important;
  padding:0;
  border:0;
  margin:0 0 20px;
}
.editorTable tbody td:not(.row-controls)::before {
  content:attr(data-field);
  display:block;
  margin:0 0 6px;
  color:#475569;
  font-size:13px;
  font-weight:700;
}
.editorTable tbody td textarea.cell,
.editorTable tbody td input.cell {
  box-sizing:border-box;
  width:100%;
  max-width:none;
}
.editorTable .cell-editor {
  width:100%;
}
.editorTable .photo-cell {
  width:100%;
}
.editorTable .photo-thumbs {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:8px;
}
.editorTable .row-controls {
  display:flex !important;
  align-items:center;
  gap:6px;
  padding-top:6px;
  margin-top:4px;
  border-top:1px solid #e5e7eb;
}
.editorTable .row-controls button {
  min-width:36px;
  min-height:34px;
}
@media(max-width:600px){
  .editorTable tbody tr {
    padding:14px;
  }
}

/* Explicit Pocketlist themes control the Edit page.
   Do NOT use body[data-theme] here: data-theme is always present and
   defaults to "clean", even when no explicit theme was selected. */
body.theme-enabled .editor-page-meta,
body.theme-enabled .cover-editor,
body.theme-enabled .editor-table-switcher,
body.theme-enabled .editor-table-block,
body.theme-enabled .field-reorder-list {
  background:var(--theme-surface) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editor-table-switcher {
  box-shadow:0 4px 14px rgba(0,0,0,.18) !important;
}

body.theme-enabled .editor-table-switcher-label,
body.theme-enabled .editor-table-position {
  color:var(--theme-muted) !important;
}

body.theme-enabled .editor-table-switch-btn,
body.theme-enabled .editor-table-switch-add,
body.theme-enabled .editor-table-top-btn {
  background:var(--theme-surface-alt) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editor-table-switch-btn:hover,
body.theme-enabled .editor-table-switch-add:hover,
body.theme-enabled .editor-table-top-btn:hover {
  background:var(--theme-surface) !important;
  border-color:var(--theme-accent) !important;
}

body.theme-enabled .editor-table-switch-btn.active {
  background:var(--theme-accent) !important;
  color:var(--theme-accent-contrast) !important;
  border-color:var(--theme-accent) !important;
}

body.theme-enabled .editor-table-title input,
body.theme-enabled .editor-page-meta input,
body.theme-enabled .editor-page-meta select {
  background:var(--theme-input) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editor-table-move-btn {
  background:var(--theme-surface-alt) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editor-table-title span,
body.theme-enabled .editor-table-title label,
body.theme-enabled .editor-meta-row > label,
body.theme-enabled .cover-editor-label,
body.theme-enabled .field-reorder-label {
  color:var(--theme-muted) !important;
}

body.theme-enabled .editorTable {
  color:var(--theme-text) !important;
  background:transparent !important;
}

body.theme-enabled .editorTable tbody {
  background:transparent !important;
}

body.theme-enabled .editorTable tbody tr {
  background:var(--theme-surface) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
  box-shadow:0 2px 8px rgba(0,0,0,.18) !important;
}

body.theme-enabled .editorTable tbody tr:hover {
  background:var(--theme-surface) !important;
}

body.theme-enabled .editorTable tbody td {
  background:transparent !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editorTable tbody td:not(.row-controls)::before {
  color:var(--theme-muted) !important;
}

body.theme-enabled .editorTable .row-controls {
  background:transparent !important;
  border-top-color:var(--theme-border) !important;
}

body.theme-enabled .editorTable thead th.col-header {
  background:var(--theme-surface-alt) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editorTable input.cell,
body.theme-enabled .editorTable textarea.cell,
body.theme-enabled .editorTable select.cell {
  background:var(--theme-input) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editorTable input.cell::placeholder,
body.theme-enabled .editorTable textarea.cell::placeholder {
  color:var(--theme-muted) !important;
}

body.theme-enabled .editorTable .row-controls button {
  background:var(--theme-surface-alt) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

body.theme-enabled .editor-table-position-track {
  background:var(--theme-border) !important;
}

body.theme-enabled .editor-table-position-progress {
  background:var(--theme-accent) !important;
}

body.theme-enabled .resize-options {
  background:var(--theme-surface) !important;
  color:var(--theme-text) !important;
  border-color:var(--theme-border) !important;
}

.photo-modal-control{
  background:rgba(255,255,255,.92);
  color:#111827;
}
.photo-modal-control:hover{
  background:#fff;
}
@media(prefers-color-scheme:dark){
  .photo-modal-control{
    background:rgba(31,41,55,.95) !important;
    color:#f8fafc !important;
  }
  .photo-modal-control:hover{
    background:#374151 !important;
  }
}
