/* ================================================================
   Data Storage — Artifacts & outputs of AgentOS (frontend-only).
   Self-contained: no external CSS/JS. White / blue / slate.
   Distinct from Documents (inputs/knowledge): table-first, folders,
   source traceability chain.
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-light: #EFF6FF;
  --bg-body: #F1F5F9;
  --bg-sidebar: #FFFFFF;
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #F1F5F9;
  --bg-hover: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;
  --border-light: #E2E8F0;
  --border-medium: #CBD5E1;
  --color-success: #10B981;
  --color-warning: #D97706;
  --color-error: #DC2626;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.18);
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
}

html.dark {
  --color-primary-light: #123653;
  --bg-body: #111111;
  --bg-sidebar: #1E1E1E;
  --bg-main: #1E1E1E;
  --bg-card: #252526;
  --bg-input: #2D2D2D;
  --bg-hover: #2D2D2D;
  --text-primary: #FFFFFF;
  --text-secondary: #CCCCCC;
  --text-muted: #A6A6A6;
  --border-light: #3E3E3E;
  --border-medium: #5A5A5A;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 0.875rem;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ---------- 3-column shell ---------- */
.app-layout {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  overflow-y: auto;
}

.sidebar-top { display: flex; flex-direction: column; gap: 8px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px; margin-bottom: 12px;
  text-decoration: none; color: inherit;
}

.brand-logo { width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }

.btn-new-task {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px 16px; margin-bottom: 8px;
  background: var(--color-primary); color: #fff; border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.btn-new-task:hover { background: var(--color-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; width: 100%;
  min-height: 42px; line-height: 1.4;
  border: 0; background: transparent; border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; text-decoration: none; text-align: left;
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-item.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }

.nav-item.active svg { stroke: var(--color-primary); }

.sidebar-bottom { padding-top: 16px; border-top: 1px solid var(--border-light); }

.workspace-info { display: flex; align-items: center; gap: 10px; }

.workspace-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input); border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.workspace-text { display: flex; flex-direction: column; min-width: 0; }

.workspace-name { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.workspace-plan { font-size: 0.72rem; color: var(--text-muted); }

/* ---------- Main ---------- */
.main-content {
  display: flex; flex-direction: column;
  min-width: 0; height: 100vh; overflow: hidden;
  background: var(--bg-main);
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 28px 12px; flex-shrink: 0;
}

.page-head h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.01em; }

.page-sub { margin: 4px 0 0; font-size: 0.83rem; color: var(--text-muted); }

.page-head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 600;
  padding: 9px 18px; border-radius: var(--radius-sm);
  cursor: pointer; border: 0;
  transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2); }

.btn-primary:hover { background: var(--color-primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }

.btn-secondary { background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-secondary); }

.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-medium); }

.btn-danger { background: rgba(220, 38, 38, 0.08); border: 1px solid rgba(220, 38, 38, 0.25); color: var(--color-error); }

.btn-danger:hover { background: rgba(220, 38, 38, 0.15); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--border-light);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
}

.icon-btn:hover, .icon-btn[aria-pressed="true"] { background: var(--bg-hover); color: var(--color-primary); border-color: var(--color-primary); }

.icon-moon { display: none; }
html.dark .icon-sun { display: none; }
html.dark .icon-moon { display: block; }

.LangSwitch { display: inline-flex; border: 1px solid var(--border-light); border-radius: var(--radius-full); overflow: hidden; background: var(--bg-card); flex-shrink: 0; }

.LangSwitch-btn { border: 0; background: none; padding: 6px 10px; font-family: var(--font-sans); font-size: 0.72rem; font-weight: 700; color: var(--text-muted); cursor: pointer; }

.LangSwitch-btn[aria-pressed="true"] { background: var(--color-primary); color: #fff; }

.select, .text-input, textarea.text-input {
  font-family: var(--font-sans); font-size: 0.82rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px; outline: none;
}

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

/* ---------- Toolbar / folders / summary ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0 28px 10px; flex-shrink: 0;
}

.search-box {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0 12px; color: var(--text-muted);
}

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

.search-box input {
  flex: 1; border: 0; background: none; outline: none;
  font-family: var(--font-sans); font-size: 0.85rem;
  color: var(--text-primary); padding: 9px 0; min-width: 0;
}

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

.folder-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 28px 10px; flex-shrink: 0;
}

.folder-tab {
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-sans); font-size: 0.78rem; font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-full);
  cursor: pointer; transition: all 0.15s var(--ease-out);
}

.folder-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }

.folder-tab.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.storage-summary {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 0 28px 10px; padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.storage-meter { flex: 1; min-width: 200px; }

.storage-meter-top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 0.78rem; margin-bottom: 6px;
}

.storage-meter-top strong { font-weight: 700; }

.storage-meter-top span { color: var(--text-muted); }

.progress-track { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }

.progress-fill { height: 100%; width: 0; background: var(--color-primary); border-radius: 4px; transition: width 0.3s var(--ease-out); }

.storage-counts { display: flex; gap: 16px; font-size: 0.78rem; color: var(--text-muted); }

.storage-counts strong { color: var(--text-primary); font-size: 0.95rem; margin-right: 4px; }

/* ---------- Bulk bar ---------- */
.bulk-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 0 28px 10px; padding: 8px 14px;
  background: var(--color-primary-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  flex-shrink: 0;
}

/* ---------- Table (only scroll region) ---------- */
.table-card {
  flex: 1; min-height: 0;
  margin: 0 28px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; overflow: hidden;
}

.table-scroll { flex: 1; overflow: auto; min-height: 0; }

.file-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }

.file-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-input);
  text-align: left; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.file-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.file-table tbody tr { cursor: pointer; transition: background 0.12s; }

.file-table tbody tr:hover { background: var(--bg-hover); }

.file-table .num { text-align: right; }

.col-check { width: 36px; }

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

.file-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.02em;
}

.file-pdf { background: rgba(220, 38, 38, 0.1); color: #DC2626; }
.file-xlsx { background: rgba(16, 185, 129, 0.12); color: #059669; }
.file-docx { background: rgba(37, 99, 235, 0.1); color: #2563EB; }
.file-json { background: rgba(124, 58, 237, 0.1); color: #7C3AED; }
.file-md { background: var(--bg-input); color: var(--text-secondary); }
.file-mp4 { background: rgba(217, 119, 6, 0.12); color: #D97706; }
.file-csv { background: rgba(217, 119, 6, 0.12); color: #D97706; }
.file-zip { background: var(--bg-input); color: var(--text-secondary); }
.file-txt { background: var(--bg-input); color: var(--text-secondary); }

.file-name {
  font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}

.file-sub { font-size: 0.72rem; color: var(--text-muted); }

.type-tag, .src-tag {
  display: inline-block;
  font-size: 0.75rem; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-full);
  white-space: nowrap;
}

.type-tag { background: var(--color-primary-light); color: var(--color-primary); }

.src-tag { background: var(--bg-input); border: 1px solid var(--border-light); color: var(--text-secondary); }

.row-actions { position: relative; text-align: right; }

.action-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 170px; padding: 4px; z-index: 30;
}

.action-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 8px 10px;
  font-family: var(--font-sans); font-size: 0.8rem; font-weight: 500;
  color: var(--text-primary); border-radius: 6px; cursor: pointer;
  text-align: left;
}

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

.action-menu button.danger { color: var(--color-error); }

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

/* ---------- Grid view ---------- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
}

@media (max-width: 1400px) {
  .file-grid { grid-template-columns: repeat(2, 1fr); }
}

.file-grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}

.file-grid-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }

.file-grid-top { display: flex; align-items: center; gap: 10px; }

.file-grid-name { font-weight: 700; font-size: 0.85rem; overflow-wrap: anywhere; }

.file-grid-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- Empty state ---------- */
.empty-state {
  padding: 48px 24px; text-align: center; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.empty-title { margin: 8px 0 0; font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }

.empty-sub { margin: 0 0 8px; font-size: 0.82rem; max-width: 380px; }

.empty-state .btn + .btn { margin-top: 4px; }

/* ---------- Right context panel (mirrors dashboard) ---------- */
.right-panel {
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rp-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.rp-section:last-child {
  border-bottom: none;
}

.rp-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rp-section-header svg {
  color: var(--text-muted);
}

.rp-section-header h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.rp-count {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

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

.rp-agent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.rp-agent-item:hover {
  background: var(--bg-hover);
}

.rp-agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rp-agent-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
}

.rp-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rp-sources-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rp-tools-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.tool-item:hover {
  background: var(--bg-hover);
}

.tool-item span {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

.tool-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-blue { background: #EFF6FF; color: #2563EB; }
.tool-green { background: #ECFDF5; color: #059669; }
.tool-purple { background: #F5F3FF; color: #7C3AED; }
.tool-amber { background: #FEF3C7; color: #D97706; }
.tool-rose { background: #FFF1F2; color: #E11D48; }

/* ---------- Drawer / modal / toast ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.45);
  animation: fade-in 0.18s var(--ease-out);
}

@keyframes fade-in { from { opacity: 0; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(430px, 100vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: drawer-in 0.22s var(--ease-out);
}

@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }

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

.drawer-head h2 { margin: 0; font-size: 1rem; }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

.drawer-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.drawer-foot:empty { display: none; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 14px 0; font-size: 0.83rem; }

.kv dt { color: var(--text-muted); font-weight: 500; }

.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.section-label {
  display: block; margin: 16px 0 8px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
}

.section-label:first-child { margin-top: 0; }

.desc-text { margin: 0; font-size: 0.83rem; color: var(--text-secondary); line-height: 1.55; }

.trace-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.trace-chain li { display: flex; gap: 10px; }

.trace-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }

.trace-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-primary); margin-top: 4px;
}

.trace-line { width: 2px; flex: 1; min-height: 14px; background: var(--border-medium); }

.trace-chain li:last-child .trace-line { display: none; }

.trace-body { padding-bottom: 14px; }

.trace-chain li:last-child .trace-body { padding-bottom: 0; }

.trace-kind { display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

.trace-name { font-size: 0.85rem; font-weight: 600; overflow-wrap: anywhere; }

.trace-chain li:last-child .trace-name { color: var(--color-primary); }

.form-group { margin-bottom: 14px; }

.form-group > label { display: block; margin-bottom: 6px; font-size: 0.78rem; font-weight: 600; }

.form-group .text-input, .form-group textarea.text-input, .form-group .select { width: 100%; }

textarea.text-input { min-height: 70px; resize: vertical; line-height: 1.5; }

.dropzone {
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 26px 16px; text-align: center;
  color: var(--text-muted); font-size: 0.83rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover, .dropzone.dragover { border-color: var(--color-primary); background: var(--color-primary-light); }

.dropzone strong { color: var(--color-primary); }

.supported { font-size: 0.75rem; color: var(--text-muted); margin: 10px 0 0; }

.file-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px; margin-top: 8px; font-size: 0.82rem;
}

.file-chip .file-name { max-width: none; flex: 1; }

.progress-track { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; margin-top: 10px; }

.progress-fill { height: 100%; width: 0; background: var(--color-primary); border-radius: 3px; transition: width 0.2s; }

.modal {
  position: fixed; z-index: 62;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(430px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: modal-in 0.18s var(--ease-out);
}

@keyframes modal-in { from { transform: translate(-50%, -48%) scale(0.97); opacity: 0; } }

.modal h2 { margin: 0 0 8px; font-size: 1.02rem; }

.modal p { margin: 0 0 14px; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.55; overflow-wrap: anywhere; }

.modal .form-group { margin-bottom: 0; }

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

.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--color-success);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px; font-size: 0.83rem; font-weight: 500;
  max-width: 340px;
  animation: toast-in 0.2s var(--ease-out);
}

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

.toast svg { flex-shrink: 0; }

.toast.success svg { color: var(--color-success); }
.toast.error svg { color: var(--color-error); }

@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  .app-layout { grid-template-columns: 220px 1fr 260px; }
}

@media (max-width: 1200px) {
  .app-layout { grid-template-columns: 64px 1fr; }
  .right-panel { display: none; }
  .sidebar { padding: 16px 8px; }
  .brand-name, .btn-new-task span, .nav-item span, .workspace-text { display: none; }
  .btn-new-task, .nav-item { justify-content: center; }
  .page-head, .toolbar, .folder-bar { padding-left: 16px; padding-right: 16px; }
  .table-card, .storage-summary, .bulk-bar { margin-left: 16px; margin-right: 16px; }
  .file-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page-head h1 { font-size: 1.15rem; }
  .file-grid { grid-template-columns: 1fr; }
  .file-table thead { display: none; }
  .file-table, .file-table tbody, .file-table tr, .file-table td { display: block; width: 100%; }
  .file-table tbody tr {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin: 10px; width: auto;
    background: var(--bg-card);
  }
  .file-table td { border: 0; padding: 6px 14px; }
  .file-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); margin-bottom: 2px;
  }
  .file-table td.col-check::before, .file-table td.row-actions::before { content: none; }
  .file-table td.row-actions { text-align: left; }
  .file-name { max-width: none; }
  .action-menu { position: static; box-shadow: none; border: 0; padding: 0; margin-top: 4px; }
}

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

/* Smooth page entry (all app pages share the same motion) */
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.main-content { animation: page-in 0.28s ease-out; }
