:root {
  color-scheme: light;
  --bg: #f8fafc; /* Slate 50 */
  --surface: #ffffff;
  --surface-soft: #f1f5f9; /* Slate 100 */
  --text: #0f172a; /* Slate 900 */
  --muted: #64748b; /* Slate 500 */
  --line: #e2e8f0; /* Slate 200 */
  --primary: #0066ff; /* Vibrant Tech Blue */
  --primary-dark: #0052cc;
  --primary-light: rgba(0, 102, 255, 0.06);
  --danger: #f43f5e; /* Rose 500 */
  --danger-light: #fff1f2;
  --success: #10b981; /* Emerald 500 */
  --success-light: #ecfdf5;
  --warning: #f59e0b; /* Amber 500 */
  --warning-light: #fffbeb;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.02);
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.15s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.app-loading :is(#loginView, #appView) {
  display: none !important;
}

body.app-loading::before {
  content: "";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 100;
  background-image: radial-gradient(circle at center, var(--primary) 0%, transparent 60%);
  background-size: 24px 24px;
  background-repeat: no-repeat;
  animation: pulse 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.2; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(0.8); opacity: 0.2; }
}

/* Main Shell Container */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  box-sizing: border-box;
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(0, 102, 255, 0.03) 0%, transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.02) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Modern Auth Panel (Login / Register) */
.auth-panel {
  margin: auto;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: authFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.login-logo-badge { font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

.login-brand h1 { font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.login-brand-subtitle { font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.stack {
  display: grid;
  gap: 20px;
}

/* Button UI Components */
button {
  min-height: 38px;
  border: 0;
  cursor: pointer;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-weight: 500;
  font-size: 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:active:not(:disabled) {
  transform: scale(0.96);
}

.primary {
  background: var(--primary);
  color: #ffffff;
  padding: 10px 16px;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.15);
}

.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.25);
}

.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
}

.ghost:hover:not(:disabled) {
  background: var(--bg);
  border-color: #cbd5e1;
}

.compact {
  min-height: 32px;
  padding: 4px 12px;
}

.icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}

.icon-button:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

/* Inputs & Form Fields */
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}

label {display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 600;
  font-size: 13px;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
}

.error, .form-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

.form-message.ok {
  color: var(--success);
}

/* App Header Header (Topbar) */
.app-view {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  animation: appFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes appFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.topbar-brand { font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.topbar-title { font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.user-name::before {
  content: "👤 ";
  font-size: 12px;
}

/* App Main Workspace */
.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Modern Left Sidebar (iPadOS Style) */
.sidebar {
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
  position: sticky;
  top: 24px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
}

.collection-list {
  display: grid;
  gap: 2px;
}

.collection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #334155;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.collection-item:hover {
  background: rgba(0, 102, 255, 0.04);
  color: var(--primary);
}

.collection-item.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.01);
  font-weight: 600;
}

.collection-item strong {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-item.active strong {
  font-weight: 600;
}

.collection-size {
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.collection-item.active .collection-size {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}

.collection-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.collection-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.collection-folder-icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.collection-item:hover .collection-folder-icon {
  color: var(--primary);
}

.collection-item.active .collection-folder-icon {
  color: var(--primary);
}

/* Right List Panel Container */
.list-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.collection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.collection-bar h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

#newRecordButton {
  background: var(--primary) !important;
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#newRecordButton:hover:not(:disabled) {
  background: var(--primary-dark) !important;
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.25);
}

.btn-plus-icon {
  display: block;
  flex-shrink: 0;
  color: #ffffff;
}

/* Filters & Search */
.filters {
  margin-bottom: 16px;
}

.filters input {
  font-size: 14px;
  padding: 10px 14px;
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.filters input::placeholder {
  color: var(--muted);
}

.filters input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}

/* Elegant Modern Table */
.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

th {position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--line);
}

tr {
  transition: background-color 0.15s ease;
}

.record-row {
  cursor: pointer;
}

/* Table Hover Row Animation */
tr:hover td {
  background-color: rgba(0, 102, 255, 0.015) !important;
}

/* Column custom classes for visual separation */
.audit-cell {
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
}

.audit-header {
  background: #f8fafc;
  color: var(--muted);
}

tr:hover .audit-cell {
  background-color: rgba(0, 102, 255, 0.015) !important;
}

/* Separate Action Columns */
.row-actions-header,
.row-actions-cell {
  position: sticky;
  right: 79px; /* Overlap by 1px to prevent browser sub-pixel flashing gap */
  z-index: 2;
  background: #fbfbfd !important;
  border-left: 1px solid var(--line);
}

.row-edit-header,
.row-edit-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fbfbfd !important;
  min-width: 80px;
  width: 80px;
  max-width: 80px;
  text-align: center;
  padding: 0;
}

.row-actions-header,
.row-edit-header {
  background: #f8fafc !important;
  border-bottom: 2px solid var(--line);
}

tr:hover .row-actions-cell,
tr:hover .row-edit-cell {
  background: #f5f5f7 !important;
}

/* Row Action Buttons Container */
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: #334155;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.row-actions button:hover {
  background: var(--bg);
  border-color: #cbd5e1;
  color: var(--text);
}

.row-actions .danger-action {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.2);
}

.row-actions .danger-action:hover {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

/* Edit Cell Layout */
.row-edit-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
}

.row-edit-affordance,
.row-delete-affordance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.row-edit-affordance:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.row-delete-affordance:hover {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

/* File Links & Sizes */
.file-links, .existing-files {
  display: grid;
  gap: 4px;
}

.file-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-size {
  color: var(--muted);
  font-size: 11px;
}

.file-size-cell {
  color: var(--text);
  font-size: 12px;
}

/* Badges Style */
.badge {display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge.warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.badge.danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.15);
}

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

/* Drawers & Modals (Slide-in Panels) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.15);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.form-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 21;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(500px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(15, 23, 42, 0.06);
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 { font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.drawer-head p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.record-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
  background: #f8fafc;
}

.form-fields {
  display: grid;
  align-content: start;
  gap: 20px;
  overflow-y: auto;
  padding: 24px;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.form-message {
  padding: 8px 24px;
  font-size: 12px;
  background: #f8fafc;
}

/* Beautiful Springy Toast Notifications */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(380px, calc(100vw - 48px));
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #ffffff;
  padding: 14px 20px;
  box-shadow: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: toastSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toastSlideUp {
  from { transform: translateY(24px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 40px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* ==========================================================================
   High-Resolution & Large Displays Responsive Scaling (2K / 4K support)
   ========================================================================== */

/* 1. Medium to High Resolution Screens (Full HD, 1080p and above) */
@media (min-width: 1440px) {
  .app-view {
    max-width: 95vw;
  }
}

/* 2. 2K Screens & Large Monitors (width >= 1920px) */
@media (min-width: 1920px) {
  :root {
    --radius: 14px;
  }
  
  body {
    font-size: 17px;
  }
  
  th, td {
    font-size: 16px;
    padding: 16px 20px;
  }
  
  th {
    font-size: 13px;
  }
  
  input, select, textarea {
    font-size: 16px;
    padding: 12px 16px;
  }
  
  button {
    font-size: 16px;
    min-height: 42px;
  }
  
  .compact {
    min-height: 36px;
    padding: 6px 14px;
  }
  
  .collection-item strong {
    font-size: 16px;
  }
  
  .section-heading h2 {
    font-size: 16px;
  }
  
  .collection-size {
    font-size: 13px !important;
  }
  
  .topbar-title {
    font-size: 28px;
  }
  
  .collection-bar h2 {
    font-size: 24px;
  }
  
  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 32px;
  }
  
  .list-panel {
    padding: 32px;
  }
  
  /* Retain edit/delete column alignment */
  .row-edit-cell, .row-edit-header {
    min-width: 96px;
    width: 96px;
    max-width: 96px;
  }
  
  .row-actions-cell, .row-actions-header {
    right: 95px; /* Overlap by 1px */
  }
  
  .row-edit-affordance, .row-delete-affordance {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }
}

/* 3. 4K Screens & Ultra-Wide Monitors (width >= 2560px) */
@media (min-width: 2560px) {
  :root {
    --radius: 16px;
  }
  
  body {
    font-size: 20px;
  }
  
  th, td {
    font-size: 19px;
    padding: 20px 24px;
  }
  
  th {
    font-size: 15px;
  }
  
  input, select, textarea {
    font-size: 19px;
    padding: 14px 20px;
  }
  
  button {
    font-size: 19px;
    min-height: 48px;
  }
  
  .compact {
    min-height: 42px;
    padding: 8px 18px;
  }
  
  .collection-item strong {
    font-size: 19px;
  }
  
  .section-heading h2 {
    font-size: 19px;
  }
  
  .collection-size {
    font-size: 15px !important;
  }
  
  .topbar-title {
    font-size: 34px;
  }
  
  .collection-bar h2 {
    font-size: 28px;
  }
  
  .workspace {
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 40px;
  }
  
  .list-panel {
    padding: 40px;
  }
  
  /* Retain edit/delete column alignment */
  .row-edit-cell, .row-edit-header {
    min-width: 110px;
    width: 110px;
    max-width: 110px;
  }
  
  .row-actions-cell, .row-actions-header {
    right: 109px; /* Overlap by 1px */
  }
  
  .row-edit-affordance, .row-delete-affordance {
    width: 38px;
    height: 38px;
    min-height: 38px;
  }
}


/* ==========================================================================
   Restored Core Utility and Layout Classes
   ========================================================================== */

/* Critical for show/hide view toggling */
.hidden {
  display: none !important;
}

/* Remove bottom border of the last table row */
tr:last-child td {
  border-bottom: none;
}

/* Sidebar empty state */
.empty-side {
  padding: 14px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Form field containers */
.field {
  display: grid;
  gap: 6px;
}

/* Form field checkboxes */
.field-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.field-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.label-config-field input {
  font-size: 14px;
}

/* File edit field widgets */
.existing-files {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  display: grid;
  gap: 4px;
}

.current-file-label,
.file-retain-hint {
  color: var(--muted);
}

.file-retain-hint {
  font-weight: 400;
}

/* Prevent horizontal overflow globally */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ==========================================================================
   Mobile & Tablet Responsive Styling (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
  /* 1. Shell Padding & General Layout */
  .shell {
    padding: 16px 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* 2. Topbar Layout */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
  }
  
  .topbar > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  
  .top-actions {
    justify-content: space-between;
    width: 100%;
    border-top: 1px dashed var(--line);
    padding-top: 8px;
  }
  
  /* 3. Main Workspace Grid */
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 100%;
  }
  
  .sidebar {
    position: static;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
    min-width: 0;
    width: 100%;
  }
  
  /* 4. Collection List & Horizontal Scroll on Mobile */
  .collection-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  
  .collection-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    padding: 6px 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
  }
  
  .collection-item.active {
    background: var(--surface);
    border-color: var(--primary);
  }
  
  .section-heading {
    margin-bottom: 8px;
    border-bottom: none;
    padding-bottom: 0;
  }
  
  /* 5. Main Content Panel */
  .list-panel {
    padding: 16px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
  }
  
  .collection-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  
  .toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .toolbar button {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 13px;
    min-height: 34px;
  }
  
  .filters input {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 6. Form Drawers */
  .form-drawer {
    width: 100vw;
  }
  
  .drawer-head {
    padding: 16px;
    gap: 12px;
  }
  
  .drawer-head h2 {
    font-size: 16px;
  }
  
  .form-fields {
    padding: 16px;
    gap: 16px;
  }
  
  .drawer-actions {
    padding: 16px;
    gap: 8px;
  }
  
  .drawer-actions button {
    flex: 1;
    min-height: 38px;
  }
  
  /* 7. Disable Sticky Behavior in Table for Small Screens */
  .row-actions-header,
  .row-edit-header {
    position: static !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    background: #f8fafc !important;
  }
  
  .row-actions-cell,
  .row-edit-cell {
    position: static !important;
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    border-left: none !important;
    background: var(--surface) !important;
  }
  
  /* Adjust row action container layout on mobile */
  .row-actions {
    flex-wrap: nowrap;
  }
}

@media (max-width: 480px) {
  /* 8. Auth Panel Adjustments */
  .auth-panel {
    padding: 28px 20px;
    gap: 20px;
  }
  
  .login-brand-subtitle {
    font-size: 13px;
  }
  
  .login-brand h1 {
    font-size: 20px;
  }
}
