/* ==========================================================================
   ROADEDITOR ASSET SERVICE - FRONTEND STYLE SHEETS
   ========================================================================== */

:root {
  /* Fonts */
  --font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* Colors (Light Theme Defaults) */
  --canvas: #eef2f6;
  --bg-panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #dde5ef;
  --border: #d8dee8;
  --text: #182230;
  --text-muted: #667085;
  
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --success: #059669;
  --success-dark: #047857;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  
  --blue: #2563eb;
  --amber: #b45309;
  --nav: #ffffff;
  --nav-2: #f8fafc;
  --header-border: #dce4ef;
  --header-text: #172033;
  --header-muted: #667085;
  --header-control-bg: #eef3f8;
  --header-control-border: #d8dee8;
  --header-control-hover: #e4ebf3;
  --header-control-text: #344054;
  --header-tab-active-bg: #172033;
  --header-tab-active-text: #ffffff;
  --header-toggle-track: #dde5ef;
  --header-toggle-thumb: #ffffff;
  
  /* Selected row / item */
  --bg-selected: #f0fdfa;
  --bg-selected-border: var(--accent);

  /* Status Colors */
  --status-ready-bg: #ecfdf5;
  --status-ready-border: #bbf7d0;
  --status-ready-text: #047857;
  
  --status-pending-bg: #fff7ed;
  --status-pending-border: #fed7aa;
  --status-pending-text: #b45309;
  
  --status-review-bg: #eff6ff;
  --status-review-border: #bfdbfe;
  --status-review-text: #1d4ed8;

  /* Shadow & Blur System */
  --shadow-soft: 0 16px 36px rgb(15 23 42 / 0.08);
  --shadow-drawer: 0 24px 72px rgb(15 23 42 / 0.2);
  --backdrop-blur: 8px;

  /* Panel Sizing */
  --side-panel-height: min(560px, calc(100dvh - 120px));
  --side-panel-top: 96px;
  --side-panel-width: 400px;
}

/* Auto Dark Theme via prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0b0f19;
    --bg-panel: #111827;
    --panel-soft: #1f2937;
    --line: #374151;
    --border: #4b5563;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --accent: #14b8a6;
    --accent-dark: #0d9488;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    
    --blue: #3b82f6;
    --amber: #f59e0b;
    --nav: #030712;
    --nav-2: #111827;
    --header-border: rgba(255, 255, 255, 0.08);
    --header-text: #ffffff;
    --header-muted: rgba(255, 255, 255, 0.72);
    --header-control-bg: rgba(255, 255, 255, 0.08);
    --header-control-border: rgba(255, 255, 255, 0.14);
    --header-control-hover: rgba(255, 255, 255, 0.14);
    --header-control-text: rgba(255, 255, 255, 0.76);
    --header-tab-active-bg: #ffffff;
    --header-tab-active-text: #182230;
    --header-toggle-track: rgba(37, 99, 235, 0.28);
    --header-toggle-thumb: #ffffff;
    
    --bg-selected: rgba(20, 184, 166, 0.12);
    
    --status-ready-bg: rgba(16, 185, 129, 0.15);
    --status-ready-border: rgba(16, 185, 129, 0.3);
    --status-ready-text: #34d399;
    
    --status-pending-bg: rgba(245, 158, 11, 0.15);
    --status-pending-border: rgba(245, 158, 11, 0.3);
    --status-pending-text: #fbbf24;
    
    --status-review-bg: rgba(59, 130, 246, 0.15);
    --status-review-border: rgba(59, 130, 246, 0.3);
    --status-review-text: #60a5fa;

    --shadow-soft: 0 16px 36px rgba(0, 0, 0, 0.35);
    --shadow-drawer: 0 24px 72px rgba(0, 0, 0, 0.55);
  }
}

/* Explicit Light Theme Selector Overrides */
[data-theme="light"] {
  color-scheme: light;

  --canvas: #eef2f6;
  --bg-panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #dde5ef;
  --border: #d8dee8;
  --text: #182230;
  --text-muted: #667085;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --success: #059669;
  --success-dark: #047857;
  --danger: #dc2626;
  --danger-dark: #b91c1c;

  --blue: #2563eb;
  --amber: #b45309;
  --nav: #ffffff;
  --nav-2: #f8fafc;
  --header-border: #dce4ef;
  --header-text: #172033;
  --header-muted: #667085;
  --header-control-bg: #eef3f8;
  --header-control-border: #d8dee8;
  --header-control-hover: #e4ebf3;
  --header-control-text: #344054;
  --header-tab-active-bg: #172033;
  --header-tab-active-text: #ffffff;
  --header-toggle-track: #dde5ef;
  --header-toggle-thumb: #ffffff;

  --bg-selected: #f0fdfa;
  --status-ready-bg: #ecfdf5;
  --status-ready-border: #bbf7d0;
  --status-ready-text: #047857;
  --status-pending-bg: #fff7ed;
  --status-pending-border: #fed7aa;
  --status-pending-text: #b45309;
  --status-review-bg: #eff6ff;
  --status-review-border: #bfdbfe;
  --status-review-text: #1d4ed8;

  --shadow-soft: 0 16px 36px rgb(15 23 42 / 0.08);
  --shadow-drawer: 0 24px 72px rgb(15 23 42 / 0.2);
}

/* Explicit Dark Theme Selector Overrides */
[data-theme="dark"] {
  color-scheme: dark;

  --canvas: #0b0f19;
  --bg-panel: #111827;
  --panel-soft: #1f2937;
  --line: #374151;
  --border: #4b5563;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --accent: #14b8a6;
  --accent-dark: #0d9488;
  --success: #10b981;
  --success-dark: #059669;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  
  --blue: #3b82f6;
  --amber: #f59e0b;
  --nav: #030712;
  --nav-2: #111827;
  --header-border: rgba(255, 255, 255, 0.08);
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.72);
  --header-control-bg: rgba(255, 255, 255, 0.08);
  --header-control-border: rgba(255, 255, 255, 0.14);
  --header-control-hover: rgba(255, 255, 255, 0.14);
  --header-control-text: rgba(255, 255, 255, 0.76);
  --header-tab-active-bg: #ffffff;
  --header-tab-active-text: #182230;
  --header-toggle-track: rgba(37, 99, 235, 0.28);
  --header-toggle-thumb: #ffffff;
  
  --bg-selected: rgba(20, 184, 166, 0.12);
  
  --status-ready-bg: rgba(16, 185, 129, 0.15);
  --status-ready-border: rgba(16, 185, 129, 0.3);
  --status-ready-text: #34d399;
  
  --status-pending-bg: rgba(245, 158, 11, 0.15);
  --status-pending-border: rgba(245, 158, 11, 0.3);
  --status-pending-text: #fbbf24;
  
  --status-review-bg: rgba(59, 130, 246, 0.15);
  --status-review-border: rgba(59, 130, 246, 0.3);
  --status-review-text: #60a5fa;

  --shadow-soft: 0 16px 36px rgba(0, 0, 0, 0.35);
  --shadow-drawer: 0 24px 72px rgba(0, 0, 0, 0.55);
}

/* ==========================================================================
   GLOBAL RESET & BASIC ELEMENTS
   ========================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-family);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  min-height: 34px;
  padding: 0 14px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease, opacity 150ms ease;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--bg-panel);
  color: var(--text);
  min-height: 34px;
  outline: none;
  padding: 0 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 184, 166, 0.12);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  min-height: 76px;
  padding: 9px 10px;
  resize: none;
}

/* Table Style Reset */
table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--panel-soft);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

tr:hover td {
  background: var(--panel-soft);
}

/* Scrollbars styling */
::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   APP CONTAINER & LAYOUTS
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--canvas);
}

.main-card {
  background: transparent;
  margin: 0 auto;
  max-width: 1440px;
  padding: 24px 34px 28px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

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

.icon-sprite {
  display: none;
}

.icon {
  display: inline-block;
  flex: 0 0 auto;
  height: 16px;
  stroke-width: 2;
  vertical-align: -2px;
  width: 16px;
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

.header {
  background: linear-gradient(135deg, var(--nav), var(--nav-2));
  border-bottom: 1px solid var(--header-border);
  box-shadow: none;
  min-height: 86px;
  padding: 18px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand::before {
  background: var(--accent);
  border-radius: 3px;
  content: '';
  display: block;
  height: 44px;
  width: 4px;
}

.brand-title {
  color: var(--header-text);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  justify-content: flex-end;
  margin-left: auto;
}

/* Tabs inside Header */
.view-tabs {
  background: var(--header-control-bg);
  border: 1px solid var(--header-control-border);
  border-radius: 8px;
  padding: 3px;
  display: flex;
  gap: 4px;
}

.view-tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--header-control-text);
  min-height: 34px;
  transition: background 150ms ease, color 150ms ease;
}

.view-tab.is-active {
  background: var(--header-tab-active-bg);
  color: var(--header-tab-active-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.view-tab:not(.is-active):hover {
  background: var(--header-control-hover);
  color: var(--header-text);
}

.theme-toggle {
  align-items: center;
  background: var(--header-control-bg);
  border: 1px solid var(--header-control-border);
  border-radius: 999px;
  color: var(--header-control-text);
  display: inline-flex;
  justify-content: center;
  min-height: 38px;
  padding: 0 4px;
  width: 66px;
}

.theme-toggle:hover {
  background: var(--header-control-hover);
  color: var(--header-text);
}

.theme-toggle-track {
  align-items: center;
  background: var(--header-toggle-track);
  border-radius: 999px;
  display: flex;
  height: 28px;
  padding: 3px;
  width: 56px;
}

.theme-toggle-thumb {
  align-items: center;
  background: var(--header-toggle-thumb);
  border-radius: 999px;
  color: #b45309;
  display: inline-flex;
  height: 22px;
  justify-content: center;
  position: relative;
  transform: translateX(0);
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), color 160ms ease;
  width: 22px;
}

.theme-toggle .icon {
  height: 14px;
  position: absolute;
  transition: opacity 160ms ease, transform 160ms ease;
  width: 14px;
}

.theme-toggle-moon {
  opacity: 0;
  transform: scale(0.65) rotate(-20deg);
}

[data-theme="dark"] .theme-toggle-thumb {
  color: #2563eb;
  transform: translateX(28px);
}

[data-theme="dark"] .theme-toggle-track {
  background: var(--header-toggle-track);
}

[data-theme="dark"] .theme-toggle-sun {
  opacity: 0;
  transform: scale(0.65) rotate(20deg);
}

[data-theme="dark"] .theme-toggle-moon {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* ==========================================================================
   STATS SECTION (STATUS STRIP)
   ========================================================================== */

.status-strip {
  align-items: stretch;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  overflow: hidden;
  max-height: 150px;
  opacity: 1;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin-bottom 0.3s ease, border-width 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.status-strip.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  pointer-events: none;
}

.status-item {
  align-items: center;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 11px;
  grid-template-columns: 32px minmax(0, 1fr);
  min-width: 0;
  padding: 14px 16px;
}

.status-item:last-child {
  border-right: 0;
}

.status-icon {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-muted);
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.status-icon .icon {
  height: 15px;
  width: 15px;
}

.status-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.status-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.status-item strong {
  color: var(--text);
  font-size: 19px;
  font-weight: 850;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status-item.is-clickable {
  cursor: pointer;
}

.status-item.is-clickable:hover {
  background: var(--panel-soft);
  border-color: var(--accent);
}

.status-item.is-clickable:focus-visible {
  outline: 3px solid var(--bg-selected-border);
  outline-offset: 2px;
}

.status-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   TOOLBAR SECTION
   ========================================================================== */

.toolbar {
  align-items: stretch;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 14px;
  justify-content: stretch;
  justify-items: stretch;
  margin-bottom: 16px;
  padding: 16px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.toolbar-controls {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns:
    minmax(260px, 1.35fr)
    minmax(138px, 0.65fr)
    minmax(138px, 0.65fr)
    minmax(170px, 0.75fr)
    auto
    auto
    auto
    auto;
  padding-top: 14px;
}

.search-shell {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.search-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 184, 166, 0.12);
  background-color: var(--bg-panel);
}

.search-shell input {
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 36px;
  padding: 0;
  width: 100%;
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.toolbar-controls button:not(.layout-toggle-button) {
  min-height: 38px;
}

#toggleStatsButton.is-active {
  background: var(--bg-panel);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.type-filter,
.sort-select {
  background: var(--panel-soft);
  border-radius: 8px;
  min-height: 38px;
  min-width: 0;
  width: 100%;
}

/* Layout Grid/List Switcher */
.layout-toggle {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  grid-template-columns: repeat(2, 34px);
  min-height: 38px;
  padding: 3px;
}

.layout-toggle-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  display: inline-flex;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  transition: background 150ms ease, color 150ms ease;
}

.layout-toggle-button .icon {
  height: 17px;
  width: 17px;
}

.layout-toggle-button.is-active {
  background: var(--bg-panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  color: var(--accent);
}

.layout-toggle-button:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
}

/* Button variants styling */
.button-primary {
  background: var(--primary);
  color: white;
}

.button-primary:not(:disabled):hover {
  background: var(--primary-dark);
}

.button-success {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff;
}

.button-success:not(:disabled):hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.button-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
}

.button-danger:not(:disabled):hover {
  background: #fee2e2;
  color: var(--danger-dark);
}

.button-plain {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.button-plain:not(:disabled):hover {
  background: var(--panel-soft);
}

.button-with-icon,
.icon-button {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  white-space: nowrap;
}

.button-small {
  font-size: 13px;
  min-height: 30px;
  padding: 0 10px;
}

/* ==========================================================================
   ASSET LISTS (TABLE VIEW)
   ========================================================================== */

.table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  min-height: 0;
  overflow: auto;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

tbody tr {
  cursor: pointer;
}

tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

tbody tr.is-empty-row {
  cursor: default;
}

tbody tr.is-selected {
  background: var(--bg-selected) !important;
}

tbody tr.is-selected td {
  background: var(--bg-selected) !important;
}

tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--bg-selected-border);
}

.col-select,
td.col-select,
.col-status,
td.col-status {
  text-align: center;
}

.col-index,
td.col-index {
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.col-time,
td.col-time {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.col-actions,
td.col-actions {
  text-align: right;
}

.asset-name {
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-name-cell {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.asset-preview {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

button.asset-preview {
  cursor: zoom-in;
  min-height: 0;
  padding: 0;
}

button.asset-preview:hover {
  border-color: var(--accent);
  background: var(--bg-panel);
}

.asset-preview img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.asset-preview.is-table {
  flex: 0 0 40px;
  height: 40px;
  width: 40px;
}

.asset-preview.is-table .icon {
  height: 18px;
  width: 18px;
}

.asset-preview.is-card,
.asset-preview.is-detail {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.asset-preview.is-detail {
  max-height: 180px;
}

.asset-preview.is-empty {
  border-style: dashed;
  flex-direction: column;
  font-size: 24px;
  gap: 6px;
}

.asset-preview.is-empty.is-broken {
  background: color-mix(in srgb, var(--panel-soft) 88%, var(--danger) 12%);
  color: var(--danger);
}

.asset-preview.is-empty::after {
  background: var(--line);
  content: "";
  height: 1px;
  opacity: 0.8;
  position: absolute;
  transform: rotate(-28deg);
  width: 70px;
}

.asset-preview.is-empty .icon,
.asset-preview-empty-text {
  position: relative;
  z-index: 1;
}

.asset-preview.is-card.is-empty .icon,
.asset-preview.is-detail.is-empty .icon {
  height: 34px;
  width: 34px;
}

.asset-preview-empty-text {
  display: none;
}

.asset-preview.is-card .asset-preview-empty-text,
.asset-preview.is-detail .asset-preview-empty-text {
  color: var(--text-muted);
  display: inline;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.asset-preview.is-broken .asset-preview-empty-text {
  color: currentColor;
}

/* Badges for asset type formats */
.asset-type {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  line-height: 1;
  max-width: 100%;
  padding: 6px 9px;
  white-space: nowrap;
}

.asset-type-icon {
  height: 14px;
  width: 14px;
}

.asset-category {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

/* Asset Status Badge styles */
.asset-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.asset-status.is-ready {
  background: var(--status-ready-bg);
  border-color: var(--status-ready-border);
  color: var(--status-ready-text);
}

.asset-status.is-pending {
  background: var(--status-pending-bg);
  border-color: var(--status-pending-border);
  color: var(--status-pending-text);
}

.asset-status.is-needs-review {
  background: var(--status-review-bg);
  border-color: var(--status-review-border);
  color: var(--status-review-text);
}

/* Tag Pills */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-pill {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 7px;
}

.meta-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.hash-cell {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Table Empty and Loading placeholder states */
.table-empty {
  color: var(--text-muted);
  padding: 36px;
  text-align: center;
}

.table-empty .empty-state {
  min-height: 220px;
  padding: 26px 18px;
}

.empty-state {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 330px;
  padding: 44px 24px;
  text-align: center;
}

.empty-icon {
  align-items: center;
  background: var(--panel-soft);
  border: 2px dashed var(--line);
  border-radius: 20px;
  display: flex;
  font-size: 0;
  height: 72px;
  justify-content: center;
  margin-bottom: 16px;
  width: 72px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.empty-state:hover .empty-icon {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.empty-icon .icon {
  height: 30px;
  width: 30px;
  color: var(--accent);
}

.empty-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.empty-table-frame {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 260px;
}

.empty-table-frame .empty-state {
  width: 100%;
}

/* ==========================================================================
   ASSET GRID VIEW (CARD LAYOUT)
   ========================================================================== */

.asset-card-list {
  display: none;
}

body.asset-layout-grid .table-wrap {
  display: none;
}

body.asset-layout-grid .asset-card-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.asset-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 14px;
  padding-bottom: 66px;
  height: 100%;
  position: relative;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.asset-card .is-card {
  grid-row: 1;
}

.asset-card .asset-card-header {
  grid-row: 2;
}

.asset-card .asset-card-meta-grid {
  grid-row: 3;
}

.asset-card .asset-card-actions {
  grid-row: 4;
}

.asset-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  border-color: var(--border);
}

.asset-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 184, 166, 0.16);
  outline: 0;
}

.asset-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 184, 166, 0.15);
}

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

.asset-card-badges {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 240px;
}

.asset-card-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.asset-card-subtitle,
.asset-card-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.asset-card-meta-grid {
  align-content: start;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.asset-card-meta strong {
  color: var(--text);
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}

.asset-card-actions {
  align-items: center;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  left: 14px;
  min-height: 30px;
  position: absolute;
  right: 14px;
}

.asset-card-actions > .row-actions {
  align-self: center;
  flex: 0 0 auto;
  margin-left: auto;
  width: auto !important;
  height: auto !important;
}

.asset-card-actions button,
.asset-card-actions label {
  flex: 0 0 auto;
  width: auto !important;
  height: auto !important;
}

/* ==========================================================================
   ACTION POPUP MENU & STATUS BAR
   ========================================================================== */

.row-actions {
  align-items: center;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  position: relative;
  white-space: nowrap;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  list-style: none;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu-trigger {
  min-width: 34px;
  padding: 0 9px;
}

.action-menu-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 184, 166, 0.16);
  outline: 0;
}

.action-menu[open] .action-menu-trigger {
  background: var(--panel-soft);
  border-color: var(--border);
  color: var(--text);
}

.action-menu-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.15);
  display: grid;
  gap: 4px;
  min-width: 128px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 8;
}

.action-menu-panel button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  display: inline-flex;
  gap: 7px;
  justify-content: flex-start;
  min-height: 32px;
  padding: 0 9px;
  text-align: left;
  width: 100%;
}

.action-menu-panel button:hover {
  background: var(--panel-soft);
}

.action-menu-panel .is-danger {
  color: var(--danger);
}

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

.toast-container {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  top: max(18px, env(safe-area-inset-top));
  z-index: 2000;
}

.toast {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow-drawer);
  color: var(--text);
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-width: min(360px, calc(100vw - 32px));
  opacity: 0;
  overflow: hidden;
  padding: 12px 12px 13px;
  pointer-events: auto;
  position: relative;
  transform: translateX(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateX(18px);
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast-icon {
  align-items: center;
  background: var(--status-ready-bg);
  border-radius: 8px;
  color: var(--accent);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.toast.is-error .toast-icon {
  background: #fef2f2;
  color: var(--danger);
}

[data-theme="dark"] .toast.is-error .toast-icon {
  background: rgba(239, 68, 68, 0.14);
}

.toast-icon .icon {
  height: 16px;
  width: 16px;
}

.toast-copy {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 18px;
  height: 28px;
  justify-content: center;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.toast-close:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.toast-progress {
  animation: toast-progress var(--toast-duration, 4200ms) linear forwards;
  background: currentColor;
  bottom: 0;
  color: var(--accent);
  height: 3px;
  left: 0;
  opacity: 0.6;
  position: absolute;
  transform-origin: left;
  width: 100%;
}

.toast.is-error .toast-progress {
  color: var(--danger);
}

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

/* Pagination Control */
.pagination {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 2px;
}

.page-info {
  color: var(--text-muted);
  font-size: 14px;
  min-width: 130px;
  text-align: center;
}

.admin-pagination {
  margin-top: 4px;
}

/* ==========================================================================
   ADMIN PANEL & CONFIGURATION
   ========================================================================== */

.admin-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.admin-card {
  display: grid;
  gap: 12px;
}

.admin-card h2 {
  font-size: 18px;
  margin: 0;
}

.admin-header,
.section-heading {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.admin-header p,
.section-heading p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 4px 0 0;
}

.admin-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
  padding-bottom: 10px;
}

.admin-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  padding: 0 12px;
  transition: background 150ms ease, border-color 150ms ease;
}

.admin-tab.is-active {
  background: var(--status-ready-bg);
  border-color: var(--status-ready-border);
  color: var(--status-ready-text);
}

.admin-tab-panel {
  display: grid;
  gap: 14px;
}

.admin-overview-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.admin-overview-card {
  align-items: flex-start;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  text-align: left;
}

.admin-overview-card strong {
  font-size: 24px;
  line-height: 1;
}

.admin-overview-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.admin-filter-bar,
.admin-batch-bar {
  align-items: end;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
}

.admin-filter-bar label {
  display: grid;
  flex: 1 1 150px;
  gap: 4px;
}

.admin-filter-bar label span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-batch-bar {
  align-items: center;
}

.admin-batch-bar input {
  flex: 1 1 220px;
  min-width: 180px;
}

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

.admin-list-item,
.type-config-item {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.admin-list-item strong,
.type-config-item strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.admin-list-item span,
.type-config-item span,
.timeline-item small,
.dependency-chip small {
  color: var(--text-muted);
  display: block;
  font-size: 12px;
  line-height: 1.45;
}

.compact-select-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.orphan-object-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.orphan-object-list button {
  max-width: min(420px, 100%);
  overflow-wrap: anywhere;
  white-space: normal;
}

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

.validation-list-main {
  display: flex;
  gap: 10px;
}

.validation-list-copy {
  min-width: 0;
}

.validation-note-input {
  margin-top: 8px;
  max-width: 360px;
  width: min(360px, 100%);
}

.admin-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px;
}

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

.settings-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.settings-item {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.settings-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
}

.settings-item span {
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   TRANSITION SYSTEM (SLIDE-IN DRAWERS & BACKDROPS)
   ========================================================================== */

.detail-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  bottom: auto;
  box-shadow: var(--shadow-drawer);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: var(--side-panel-height);
  max-width: min(var(--side-panel-width), calc(100vw - 32px));
  overscroll-behavior: contain;
  overflow: hidden;
  position: fixed;
  right: 24px;
  top: var(--side-panel-top);
  width: var(--side-panel-width);
  z-index: 40;
  
  /* Floating right-side panel. It overlays content without resizing the list. */
  transform: translateX(120%);
  opacity: 0.9;
  visibility: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.4s;
}

.detail-panel:not(.hidden) {
  display: grid !important; /* override display: none */
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.detail-panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px;
}

.detail-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.3;
}

.detail-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.detail-body {
  display: grid;
  gap: 16px;
  min-height: 0;
  overscroll-behavior: contain;
  overflow: auto;
  padding: 16px;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section h3 {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  margin: 0;
}

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

.detail-item {
  min-width: 0;
}

.detail-label {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.detail-value {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-code {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
}

.json-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.json-panel-header,
.json-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.json-panel-header {
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  justify-content: flex-end;
  padding: 8px 10px;
}

.json-panel .detail-code {
  border: 0;
  border-radius: 0;
  margin: 0;
  max-height: 240px;
}

.json-tree {
  background: var(--panel-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
}

.json-tree-row,
.json-tree-node summary {
  overflow-wrap: anywhere;
  padding: 3px 0;
}

.json-tree-node summary {
  cursor: pointer;
}

.json-tree-node summary:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.json-tree-children {
  border-left: 1px solid var(--line);
  margin-left: 8px;
  padding-left: 12px;
}

.json-tree-key {
  color: var(--primary);
  font-weight: 700;
}

.json-tree-colon,
.json-muted {
  color: var(--text-muted);
}

.json-key {
  color: var(--primary);
}

.json-string {
  color: var(--success);
}

.json-number {
  color: var(--amber);
}

.json-boolean {
  color: var(--accent);
}

.json-null {
  color: var(--text-muted);
}

.json-feedback {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  min-height: 18px;
}

.json-feedback.is-error {
  color: var(--danger);
}

.json-feedback.is-success {
  color: var(--success);
}

textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.json-tools {
  justify-content: flex-end;
  margin-bottom: 8px;
}

/* 2. Upload Drawer and Dialog Backdrop */
.upload-drawer-backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(var(--backdrop-blur));
  inset: 0;
  position: fixed;
  z-index: 20;
  opacity: 1;
  visibility: visible;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: var(--side-panel-top) 24px 0 0;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-drawer-backdrop.hidden {
  display: flex !important; /* override display: none */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.upload-drawer {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-drawer);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: var(--side-panel-height);
  max-width: min(var(--side-panel-width), calc(100vw - 32px));
  overflow: hidden;
  width: var(--side-panel-width);
  
  /* Slide in effect */
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-drawer-backdrop:not(.hidden) .upload-drawer {
  transform: translateX(0);
}

/* Fallback for general modals if any */
.modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(var(--backdrop-blur));
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 10;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal.hidden {
  display: none; /* simple hidden for non-sidebar modals */
}

.modal-panel {
  background: var(--bg-panel);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  max-width: 640px;
  width: 100%;
}

.modal-header {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header-icon {
  align-items: center;
  background: var(--status-ready-bg);
  border-radius: 8px;
  color: var(--accent);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.modal-header-icon .icon {
  height: 18px;
  width: 18px;
}

.modal-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.modal-body {
  gap: 14px;
  grid-template-columns: 1fr;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

.modal-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
}

.custom-confirm-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(var(--backdrop-blur));
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  position: fixed;
  transition: opacity 160ms ease;
  z-index: 2400;
}

.custom-confirm-overlay.is-visible {
  opacity: 1;
}

.custom-confirm-overlay.is-leaving {
  opacity: 0;
}

.custom-confirm-card {
  background: color-mix(in srgb, var(--bg-panel) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-drawer);
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  max-width: 460px;
  padding: 18px;
  transform: translateY(10px) scale(0.98);
  transition: transform 180ms ease;
  width: 100%;
}

.custom-confirm-overlay.is-visible .custom-confirm-card {
  transform: translateY(0) scale(1);
}

.custom-confirm-icon {
  align-items: center;
  background: var(--status-ready-bg);
  border-radius: 8px;
  color: var(--accent);
  display: inline-flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.custom-confirm-icon.is-danger {
  background: #fef2f2;
  color: var(--danger);
}

[data-theme="dark"] .custom-confirm-icon.is-danger {
  background: rgba(239, 68, 68, 0.14);
}

.custom-confirm-icon .icon {
  height: 18px;
  width: 18px;
}

.custom-confirm-copy {
  min-width: 0;
}

.custom-confirm-copy h2 {
  color: var(--text);
  font-size: 17px;
  line-height: 1.3;
  margin: 0;
  text-wrap: pretty;
}

.custom-confirm-message {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.custom-confirm-message p {
  margin: 0;
}

.custom-confirm-message p + p {
  margin-top: 4px;
}

.custom-confirm-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.lightbox-overlay {
  background: rgba(3, 7, 18, 0.84);
  display: flex;
  inset: 0;
  opacity: 0;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  position: fixed;
  transition: opacity 180ms ease;
  z-index: 2600;
}

.lightbox-overlay.is-visible {
  opacity: 1;
}

.lightbox-overlay.is-leaving {
  opacity: 0;
}

.lightbox-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  width: 100%;
}

.lightbox-toolbar {
  align-items: center;
  color: #ffffff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 12px;
}

.lightbox-toolbar h2 {
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.lightbox-stage {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  cursor: grab;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.lightbox-stage:active {
  cursor: grabbing;
}

.lightbox-image {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  transform-origin: center;
  transition: transform 80ms ease;
  will-change: transform;
}

/* ==========================================================================
   FORM & UPLOAD WIDGETS
   ========================================================================== */

.form-row {
  display: grid;
  gap: 8px;
}

.form-row label {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.form-row.is-wide,
.is-wide {
  grid-column: 1 / -1;
}

.form-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.file-input {
  align-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  min-height: 64px;
  padding: 12px;
  position: relative;
  background: var(--panel-soft);
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.18s ease;
}

.file-input:hover {
  border-color: var(--accent);
  background-color: var(--bg-panel);
}

.drop-zone.is-dragging {
  background: rgba(20, 184, 166, 0.08);
  border-color: var(--accent);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
  transform: scale(0.992);
}

.file-input input {
  cursor: pointer;
  height: 100%;
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
  z-index: 1;
}

.file-input:focus-within,
.preview-file-control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.drop-zone-copy {
  color: var(--text-muted);
  display: grid;
  flex: 1;
  font-size: 12px;
  gap: 4px;
  min-width: 0;
}

.drop-zone-copy strong {
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-editor {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 38px;
  padding: 5px 7px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.tag-editor:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tag-editor-list {
  display: contents;
}

.tag-editor input {
  border: 0;
  box-shadow: none;
  flex: 1 1 160px;
  min-height: 28px;
  padding: 0 4px;
}

.tag-editor-chip {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
  line-height: 1;
  padding: 5px 7px;
}

.tag-editor-chip button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 14px;
  height: 16px;
  justify-content: center;
  min-height: 16px;
  padding: 0;
  width: 16px;
}

.preview-picker {
  display: grid;
  gap: 8px;
}

.preview-file-control {
  align-items: center;
  align-self: start;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  position: relative;
  width: fit-content;
}

.preview-file-control input {
  cursor: pointer;
  height: 100%;
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

.upload-preview-box {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: var(--panel-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  max-height: 160px;
  min-height: 96px;
  overflow: hidden;
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-preview-box.is-empty {
  padding: 16px;
}

.upload-preview-box img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

/* Dependencies selector widget */
.dependency-picker {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.dependency-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 240px;
  overflow: auto;
}

.dependency-option {
  align-items: flex-start;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dependency-option:hover {
  border-color: var(--border);
  background-color: var(--bg-panel);
}

.dependency-option strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.dependency-option small {
  color: var(--text-muted);
  display: block;
  font-size: 12px;
  line-height: 1.45;
}

.dependency-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dependency-search-input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  width: 200px;
  min-height: 28px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dependency-search-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--bg-selected-border);
}

.dependency-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
  overflow: hidden;
}

.dependency-group-header {
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  padding: 9px 10px;
  text-transform: uppercase;
  user-select: none;
}

.dependency-group-header::marker {
  color: var(--accent);
}

.dependency-group[open] .dependency-group-header {
  border-bottom: 1px solid var(--line);
}

.dependency-group-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
}

.dependency-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dependency-chip {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: inline-grid;
  font-size: 12px;
  font-weight: 800;
  gap: 2px;
  padding: 7px 9px;
}

/* Version History Timeline widget */
.timeline-list {
  display: grid;
  gap: 8px;
}

.timeline-item {
  align-items: flex-start;
  display: flex;
  gap: 8px;
}

.timeline-item .icon {
  color: var(--accent);
  height: 16px;
  margin-top: 2px;
  width: 16px;
}

.timeline-item strong {
  color: var(--text);
  display: block;
  font-size: 13px;
}

/* Advanced JSON collapsible details */
.advanced-upload {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.advanced-upload summary {
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  outline: none;
}

.advanced-upload .form-row {
  margin-top: 12px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */

/* Tablet Breakpoint (Under 1120px) */
@media (max-width: 1120px) {
  .toolbar-controls {
    grid-template-columns: minmax(240px, 1fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr);
  }

  .toolbar-controls .icon-button,
  .toolbar-controls .layout-toggle,
  .toolbar-controls .toolbar-upload,
  .toolbar-controls #batchDeleteButton {
    width: 100%;
  }

  .toolbar-controls .layout-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile Breakpoint (Under 760px) */
@media (max-width: 760px) {
  .header {
    gap: 14px;
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
    position: relative;
  }

  .brand {
    gap: 11px;
    padding-right: 0;
  }

  .brand::before {
    height: 38px;
  }

  .brand-title {
    font-size: 18px;
  }

  .view-tabs {
    flex: 1;
    width: 100%;
  }

  .view-tab {
    flex: 1;
  }

  .header-actions {
    margin-left: 0;
    width: 100%;
  }

  .theme-toggle {
    flex: 0 0 66px;
  }

  .main-card {
    padding: 16px;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 12px;
  }

  .status-item {
    border-bottom: 1px solid var(--line);
    gap: 9px;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 10px 12px;
  }

  .status-item:nth-child(2n) {
    border-right: 0;
  }

  .status-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .status-item strong {
    font-size: 17px;
  }

  .toolbar {
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
  }

  .toolbar-controls {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 10px;
  }

  .toolbar-upload {
    grid-column: 1 / -1;
  }

  .search-shell {
    grid-column: 1 / -1;
    min-height: 36px;
  }

  .table-wrap {
    display: none;
  }

  .asset-card-list {
    display: grid;
    gap: 10px;
  }

  .asset-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .asset-card-badges {
    align-items: flex-start;
    justify-content: flex-start;
    max-width: none;
  }

  .asset-card-meta-grid {
    grid-template-columns: 1fr;
  }

  .pagination {
    align-items: stretch;
    justify-content: stretch;
  }

  .pagination button,
  .page-info {
    flex: 1;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Slide up from bottom transition on mobile */
  .detail-panel {
    border-radius: 12px 12px 0 0;
    bottom: 0;
    height: min(560px, 72svh);
    left: 0;
    max-height: 72svh;
    max-width: none;
    right: 0;
    top: auto;
    width: auto;
    transform: translateY(120%);
    opacity: 0.95;
  }
  
  .detail-panel:not(.hidden) {
    transform: translateY(0);
  }

  .upload-drawer-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .upload-drawer {
    border-radius: 12px 12px 0 0;
    height: min(560px, 72svh);
    max-height: 72svh;
    max-width: none;
    width: 100%;
    transform: translateY(120%);
  }

  .upload-drawer-backdrop:not(.hidden) .upload-drawer {
    transform: translateY(0) !important;
  }
}

/* ==========================================================================
   DAILY ASSET WORKBENCH
   ========================================================================== */

.header {
  min-height: 80px;
}

.brand::before {
  background: linear-gradient(180deg, var(--accent) 0 68%, var(--amber) 68% 100%);
  height: 40px;
}

.brand-title {
  font-size: 20px;
}

.main-card {
  padding-top: 20px;
}

.toolbar {
  border-radius: 12px;
  gap: 12px;
  padding: 17px 18px 16px;
}

.asset-category-rail {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
}

.asset-category-shortcut {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  display: inline-flex;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
}

.asset-category-shortcut:hover {
  border-color: var(--border);
  color: var(--text);
}

.asset-category-shortcut.is-active {
  background: var(--bg-selected);
  border-color: var(--accent);
  color: var(--accent);
}

.asset-category-count {
  background: var(--bg-panel);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  min-width: 22px;
  padding: 0 5px;
  text-align: center;
}

.asset-category-shortcut.is-active .asset-category-count {
  color: var(--accent);
}

.toolbar-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 12px;
}

.search-shell {
  flex: 1 1 240px;
  min-width: min(240px, 100%);
}

.toolbar-controls .type-filter {
  flex: 0 1 145px;
  width: auto;
}

.toolbar-controls .sort-select {
  flex: 0 1 175px;
  width: auto;
}

.search-clear {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--text-muted);
  flex: 0 0 24px;
  font-size: 18px;
  line-height: 24px;
  min-height: 24px !important;
  padding: 0;
  width: 24px;
}

.search-clear:hover {
  background: var(--line);
  color: var(--text);
}

.search-input::-webkit-search-cancel-button {
  appearance: none;
}

.toolbar-upload {
  margin-left: auto;
}

.admin-panel.is-inventory-mode ~ .toolbar .toolbar-upload {
  display: none;
}

.admin-panel {
  border-radius: 12px;
  gap: 12px;
  margin-bottom: 15px;
  padding: 18px 20px;
}

.admin-login-card {
  gap: 18px;
  margin: 8px auto;
  max-width: 540px;
  width: 100%;
}

.admin-login-intro h2,
.admin-header h2 {
  margin-top: 6px;
}

.admin-login-form {
  align-items: end;
  display: flex;
  gap: 10px;
}

.admin-login-form .form-row {
  flex: 1 1 auto;
}

.admin-login-form .toolbar-group {
  flex: 0 0 auto;
}

.admin-header {
  align-items: center;
}

.admin-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.admin-tabs {
  align-items: stretch;
  border-bottom: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
  margin: 10px 0 0;
  padding-bottom: 0;
}

.admin-nav-group {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
}

.admin-nav-group-heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-nav-label {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
  line-height: 1.4;
  margin: 0;
  white-space: nowrap;
}

.admin-nav-label::before {
  background: var(--accent);
  border-radius: 2px;
  content: '';
  height: 13px;
  width: 3px;
}

.admin-nav-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-tab {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  padding: 0 10px;
}

.admin-tab-count {
  background: var(--status-pending-bg);
  border: 1px solid var(--status-pending-border);
  border-radius: 999px;
  color: var(--status-pending-text);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 17px;
  min-width: 20px;
  padding: 0 4px;
  text-align: center;
}

.admin-tab-count.is-empty {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text-muted);
}

.admin-overview-card {
  border-left: 3px solid var(--line);
  min-height: 76px;
}

.admin-overview-card:hover {
  border-left-color: var(--accent);
}

.asset-card {
  border-radius: 12px;
  gap: 10px;
  padding-bottom: 61px;
}

.asset-card:hover {
  transform: translateY(-2px);
}

.asset-card-badges {
  align-items: center;
  justify-content: flex-start;
  max-width: none;
}

.asset-card-header {
  align-items: stretch;
  flex-direction: column;
  gap: 7px;
}

.asset-card-domain-tags {
  grid-column: 1 / -1;
}

.tag-list {
  gap: 5px;
}

.tag-pill {
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-section-heading {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 13px;
}

.upload-section-heading strong {
  color: var(--text);
  font-size: 13px;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-suggestion {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 11px;
  min-height: 26px;
  padding: 0 9px;
}

.tag-suggestion:hover,
.tag-suggestion.is-selected {
  background: var(--bg-selected);
  border-color: var(--accent);
  color: var(--accent);
}

.dependency-picker-summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
}

.dependency-picker-summary::-webkit-details-marker {
  display: none;
}

.dependency-picker-summary span:last-child {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.dependency-picker[open] .dependency-picker-summary {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

@media (max-width: 980px) {
  .admin-tabs {
    gap: 9px;
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-shell {
    grid-column: 1 / -1;
  }

  .toolbar-controls .type-filter,
  .toolbar-controls .sort-select {
    width: 100%;
  }

  .toolbar-upload {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .header {
    min-height: 72px;
  }

  .brand-title {
    font-size: 17px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-header-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .admin-header-actions button {
    flex: 1 1 120px;
  }

  .admin-login-form {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-login-form .toolbar-group,
  .admin-login-form .toolbar-group button {
    width: 100%;
  }

  .asset-category-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .asset-category-shortcut {
    flex: 0 0 auto;
  }

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

  .asset-card-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Shimmer Skeleton Loader --- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--panel-soft) 25%,
    var(--line) 37%,
    var(--panel-soft) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

@media (prefers-color-scheme: dark) {
  .skeleton-shimmer {
    background: linear-gradient(
      90deg,
      var(--panel-soft) 25%,
      #374151 37%,
      var(--panel-soft) 63%
    );
    background-size: 200% 100%;
  }
}

[data-theme="dark"] .skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--panel-soft) 25%,
    #374151 37%,
    var(--panel-soft) 63%
  );
  background-size: 200% 100%;
}

.skeleton-block {
  border-radius: 4px;
  display: inline-block;
  height: 12px;
  vertical-align: middle;
}

.skeleton-text {
  height: 12px;
  width: 80%;
}

.skeleton-text-short {
  height: 12px;
  width: 40%;
}

.skeleton-avatar {
  border-radius: 6px;
  height: 38px;
  width: 38px;
}

.skeleton-badge {
  border-radius: 999px;
  height: 22px;
  width: 60px;
}

.skeleton-btn {
  border-radius: 6px;
  height: 32px;
  width: 64px;
}

.skeleton-card-preview {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  width: 100%;
  margin-bottom: 12px;
}

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

  .skeleton-shimmer {
    animation: none;
    background-position: 0 0;
  }
}

/* The sign-in page shares the portal's theme and native control styles. */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 400px);
  padding: 32px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-panel);
}

.login-brand {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.login-panel h1 { margin: 0 0 24px; font-size: 28px; }
.login-panel form { display: grid; gap: 10px; }
.login-panel label { font-size: 14px; font-weight: 600; }
.login-panel input { width: 100%; min-height: 44px; }
.login-panel input + label { margin-top: 8px; }
.login-password-field { display: flex; gap: 8px; }
.login-password-field input { min-width: 0; }
.login-password-field button { flex: 0 0 auto; }
.login-error { min-height: 44px; margin: 0; color: var(--danger); font-size: 14px; }
.login-panel button[type="submit"] { min-height: 44px; }

@media (max-width: 420px) {
  .login-page { padding: 16px; }
  .login-panel { padding: 24px; }
}
