:root {
  --bg: #f4f6f6;
  --panel: #fff;
  --panel-hover: #f0f4f3;
  --border: #dbe3e3;
  --text: #1b2a30;
  --muted: #62747a;
  --primary: #147d77;
  --primary-hover: #0f6661;
  --danger: #bb3d43;
  --danger-hover: #9d3036;
  --success: #167a5c;
  --warn: #aa6d19;
  --sidebar: #17282d;
  --sidebar-text: #e9f1f0;
  --sidebar-muted: #a5b9ba;
  --ink-panel: #eaf0ef;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
.hidden { display: none !important; }
.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.mobile-topbar, .sidebar-scrim, .mobile-close-button { display: none; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid #263d42;
  padding: 24px 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand {
  padding: 0 10px 22px;
  margin-bottom: 12px;
  border-bottom: 1px solid #385057;
}
.brand-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand h1 { font-size: 17px; font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.brand p { font-size: 12px; color: var(--sidebar-muted); margin-top: 4px; }
.nav-section-title {
  font-size: 11px;
  color: var(--sidebar-muted);
  margin: 20px 10px 8px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  margin-bottom: 3px;
  border-radius: 6px;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: #254047; }
.nav-item.active { background: #26524f; color: #fff; box-shadow: inset 3px 0 #67d2bc; }
.nav-item .badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 9999px;
  background: #36545a;
}
.sidebar-footer {
  border-top: 1px solid #385057;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer .btn { background: #243b41; color: var(--sidebar-text); border-color: #365158; }
.sidebar-footer .btn:hover { background: #315057; }
.main-content {
  min-width: 0;
  padding: 30px clamp(24px, 3.2vw, 52px) 64px;
  overflow-y: auto;
  max-height: 100vh;
}
.main-content > section { width: 100%; max-width: 1440px; margin-inline: auto; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px 24px;
}
.page-header h2 { font-size: 23px; font-weight: 700; color: var(--text); }
.page-header p { font-size: 13px; color: var(--muted); margin-top: 5px; max-width: 72ch; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--panel); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--panel-hover); border-color: #b8c7c6; }
.btn-danger { background: #fff7f7; color: var(--danger); border-color: #e6c4c7; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn:focus-visible, .nav-item:focus-visible, .folder-btn:focus-visible, .tab-pill:focus-visible,
.mobile-nav-button:focus-visible { outline: 2px solid #54aa9a; outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-sm {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
}

/* Status Banner (Upload & Integrity & Alerts) */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 11px 16px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.status-banner.is-success {
  border-left-color: var(--success);
  background: #f7fbf9;
}
.status-banner.is-running {
  border-left-color: var(--primary);
  background: #f4faf9;
}
.status-banner.is-warn {
  border-left-color: var(--warn);
  background: #fdfaf2;
}
.status-banner.is-error {
  border-left-color: var(--danger);
  background: #fdf6f6;
}
.status-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.status-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  flex-shrink: 0;
  background: #e6f4f1;
}
.status-banner.is-success .status-banner-icon {
  background: #e6f7ef;
}
.status-banner.is-warn .status-banner-icon {
  background: #fef3c7;
}
.status-banner.is-error .status-banner-icon {
  background: #fee2e2;
}
.status-banner-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.status-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--ink-panel);
  color: var(--muted);
}
.status-pill-success {
  background: #def7ec;
  color: #03543f;
}
.status-pill-warn {
  background: #feecdc;
  color: #92400e;
}
.status-banner-close {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.status-banner-close:hover {
  color: var(--text);
  background: var(--panel-hover);
}

/* Integrity Modal Summary Grid & Issues Table */
.integrity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.integrity-grid-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  text-align: center;
}
.integrity-grid-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.integrity-grid-val.is-success {
  color: var(--success);
}
.integrity-grid-val.is-warn {
  color: var(--warn);
}
.integrity-grid-lbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.integrity-issues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.integrity-issues-table th, .integrity-issues-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.integrity-issues-table th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-val { font-size: 24px; font-weight: 700; color: var(--text); margin-top: 5px; }
.stat-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
#tab-image-host .stats-row {
  gap: 0;
  padding: 0 0 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
#tab-image-host .stats-row .stat-card {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 0 20px;
}
#tab-image-host .stats-row .stat-card:first-child { padding-left: 0; }
#tab-image-host .stats-row .stat-card:last-child { border-right: 0; }
#tab-image-host .stat-val { font-size: 21px; margin-top: 2px; }
.upload-zone {
  border: 1px dashed #a9c6c2;
  background: #f4faf8;
  border-radius: 6px;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: #e9f5f1;
}
.explorer-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.folder-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  position: sticky;
  top: 0;
}
.folder-panel-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.folder-toggle {
  display: none;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.folder-toggle:focus-visible { outline: 2px solid #54aa9a; outline-offset: 2px; }
.folder-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.folder-btn:hover { background: var(--panel-hover); }
.folder-btn.active { background: #e3f2ee; color: #0b645f; font-weight: 600; }
.folder-btn.month-node { padding-left: 24px; font-size: 12.5px; }
.folder-count { font-size: 11px; color: var(--muted); background: #edf1f0; padding: 1px 6px; border-radius: 10px; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 12px;
  align-items: start;
}
.img-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.img-card:hover {
  border-color: #a9c4c0;
  box-shadow: 0 4px 14px rgba(24, 52, 55, 0.08);
}
.img-thumb-wrap {
  width: 100%;
  height: 155px;
  background: #edf1f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.img-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.img-tag {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(24, 40, 44, 0.82);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  color: #cbd5e1;
}
.img-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 10px;
}
.img-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.img-meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-more { min-width: 0; }
.card-more summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.card-more summary::-webkit-details-marker { display: none; }
.card-more summary:hover { background: var(--panel-hover); color: var(--text); }
.card-more summary:focus-visible { outline: 2px solid #54aa9a; outline-offset: 2px; }
.card-more[open] .card-more-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.link-tracks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.track-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f6f8f8;
  border: 1px solid #e8eded;
  border-radius: 6px;
  padding: 4px 6px;
}
.track-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  text-align: center;
  min-width: 42px;
}
.track-raw {
  background: #e8edf4;
  color: #365a80;
  border: 1px solid #cfdae5;
}
.track-webp {
  background: #e3f3ec;
  color: #177052;
  border: 1px solid #c6e4d6;
}
.track-row .btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}
.card-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.card-footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-footer-actions .btn {
  padding: 4px 8px;
  font-size: 11px;
}
.card-actions .btn {
  padding: 5px 8px;
  font-size: 11.5px;
}
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #20373b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 6px;
  border: 1px solid #355459;
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
  font-size: 13px;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 28, 31, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 8000;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 20px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2f1;
}
.modal-body img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input {
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13.5px;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--primary); outline: 2px solid #cce9e2; outline-offset: 1px; }
.form-grid { display: grid; gap: 12px; }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid-port { grid-template-columns: minmax(0, 1fr) 160px; }
.form-grid-text { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.form-grid-upstream { grid-template-columns: minmax(0, 1.4fr) 160px minmax(0, 1fr); align-items: end; }
.secret-input-row { display: flex; align-items: center; gap: 8px; }
.secret-input-row .form-input { flex: 1; }
.secret-input-row .btn { flex-shrink: 0; }
.secret-actions { flex-wrap: wrap; justify-content: flex-end; }
.secret-actions code { max-width: 100%; overflow-wrap: anywhere; }
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(25, 49, 53, 0.1);
}
.login-title { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 24px; }
.err-msg {
  background: #fff3f3;
  border: 1px solid #ebc7c9;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.inline-code {
  font-family: var(--font-mono);
  background: #e9f1f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #126f68;
}
.progress-track {
  background: #e6eceb;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #e9eeee;
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--muted); }
.kv-val { font-weight: 600; text-align: right; word-break: break-all; }

.tab-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  background: #e9efee;
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 7px;
}
.tab-pill {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-pill:hover {
  color: var(--text);
  background: #fff;
}
.tab-pill.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(24, 52, 55, 0.12);
}

.search-input { width: min(100%, 260px); }
.readonly-field {
  min-height: 38px;
  padding: 8px 10px;
  background: #f5f8f7;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.readonly-field > span { min-width: 0; overflow-wrap: anywhere; }
.source-lock { padding: 2px 6px; background: #e2f2eb; border-radius: 4px; color: #176e51; font-size: 11px; white-space: nowrap; }
.code-panel {
  padding: 12px 14px;
  background: #203339;
  border: 1px solid #304b51;
  border-radius: 6px;
  color: #e2eeeb;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
}
.code-panel > div:first-child { color: #b3cbc6 !important; }
#tab-maintenance .stat-card { border-color: var(--border) !important; }
#tab-maintenance .stat-card + .stat-card { margin-top: 18px; }
#tab-settings .stat-card, #tab-security .stat-card { max-width: 940px !important; }
#totpResultBox { background: #f5f8f7; }
.share-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px 16px; }
.share-table-wrap { overflow-x: auto; }
.share-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
.share-table th, .share-table td { padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.share-table th { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.share-table tr:last-child td { border-bottom: 0; }
.share-table td:first-child { font-weight: 600; overflow-wrap: anywhere; }
.share-table td > * { min-width: 0; }
.share-url { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-status { font-weight: 600; }
.share-status.active { color: var(--success); }
.share-status.expired { color: var(--danger); }
.share-actions { white-space: nowrap; text-align: right !important; }
.share-actions .btn + .btn { margin-left: 6px; }

@media (max-width: 1120px) {
  .form-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-upstream { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-upstream > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .explorer-layout { grid-template-columns: minmax(0, 1fr); }
  .folder-panel { position: static; }
  .main-content { padding-inline: 24px; }
}

@media (max-width: 760px) {
  .layout { display: block; }
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    border-bottom: 1px solid #385057;
  }
  .mobile-topbar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .mobile-nav-button {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid #476168;
    border-radius: 6px;
    background: #243d43;
    color: #fff;
    cursor: pointer;
    font-size: 19px;
    line-height: 1;
  }
  .mobile-close-button { display: block; }
  .sidebar {
    position: fixed;
    z-index: 80;
    left: 0;
    top: 0;
    width: min(280px, 85vw);
    height: 100dvh;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
  }
  .sidebar-scrim {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: none;
    width: 100%;
    border: 0;
    background: rgba(9, 26, 29, 0.52);
    cursor: pointer;
  }
  .layout.nav-open .sidebar { visibility: visible; transform: translateX(0); }
  .layout.nav-open .sidebar-scrim { display: block; }
  .main-content { max-height: none; overflow: visible; padding: 24px 20px 48px; }
  .header-actions { justify-content: flex-start; }
  .form-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .main-content { padding: 20px 16px 44px; }
  .page-header { margin-bottom: 20px; padding-bottom: 18px; }
  .page-header h2 { font-size: 20px; }
  .page-header p { font-size: 12.5px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1 1 auto; }
  .stats-row { gap: 8px; margin-bottom: 16px; }
  #tab-image-host .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  #tab-image-host .stats-row .stat-card { padding: 0 8px; }
  #tab-image-host .stat-label { font-size: 11px; }
  #tab-image-host .stat-val { font-size: 16px; overflow-wrap: anywhere; }
  #tab-image-host .stat-hint { display: none; }
  .stat-card { padding: 16px; }
  .upload-zone { padding: 16px 12px; margin-bottom: 18px; }
  #tab-image-host .upload-zone { display: none; }
  .folder-panel { padding: 6px 8px; }
  .folder-panel-header { padding: 2px 4px; margin: 0; border: 0; gap: 8px; }
  .folder-panel-header #folderCountHint { margin-left: auto; }
  .folder-toggle { display: inline-block; }
  .folder-panel:not(.is-open) #folderTreeList { display: none; }
  .folder-panel.is-open #folderTreeList { padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }
  .form-grid-two, .form-grid-three, .form-grid-four,
  .form-grid-port, .form-grid-text, .form-grid-upstream { grid-template-columns: minmax(0, 1fr); }
  .form-grid-upstream > :first-child { grid-column: auto; }
  .toolbar { align-items: stretch; }
  .toolbar > div { width: 100%; flex-wrap: wrap; }
  .toolbar > div:last-child, .search-input { width: 100%; }
  .kv-row { align-items: flex-start; flex-wrap: wrap; gap: 4px 12px; }
  .kv-val { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
  #tab-integration .kv-val, #subtab-settings-integration .kv-val { flex-wrap: wrap; justify-content: flex-start !important; }
  #tab-integration code, #subtab-settings-integration code { max-width: 100%; overflow-wrap: anywhere; }
  .tab-pills { width: 100%; }
  .tab-pill { flex: 1 1 auto; padding: 7px 9px; }
  .modal-header { flex-wrap: wrap; gap: 12px; }
  .modal-header > div { flex-wrap: wrap; }
  #tab-settings .stat-card, #tab-media .stat-card, #tab-integration .stat-card, #tab-security .stat-card { max-width: none !important; }
  .share-panel { padding: 0; background: transparent; border: 0; }
  .share-table-wrap { overflow: visible; }
  .share-table, .share-table tbody, .share-table tr, .share-table td { display: block; width: 100%; }
  .share-table thead { display: none; }
  .share-table tr { padding: 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
  .share-table td { display: flex; gap: 12px; padding: 5px 0; border: 0; min-width: 0; }
  .share-table td::before { content: attr(data-label); flex: 0 0 76px; color: var(--muted); font-size: 12px; font-weight: 500; }
  .share-table td:first-child { font-weight: 600; }
  .share-url { max-width: 100%; white-space: normal; word-break: break-all; }
  .share-actions { display: flex !important; align-items: center; flex-wrap: wrap; text-align: left !important; white-space: normal; }
  .share-actions .btn + .btn { margin-left: 0; }
}

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


