/* ==========================================================================
   Files Online — Production Stylesheet
   Design language: premium productivity tool (Linear/Notion style)
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  --bg: #F9F9F8;
  --surface: #FFFFFF;
  --surface-hover: #F4F4F3;
  --surface-active: #EEEEED;
  --border: #E4E4E2;
  --border-strong: #CCCCCA;
  --text: #1C1C1A;
  --text-2: #5A5956;
  --text-3: #9A9896;
  --accent: #1B4FD8;
  --accent-hover: #1640B8;
  --accent-light: #EEF2FF;
  --success: #16A34A;
  --success-light: #F0FDF4;
  --warning: #D97706;
  --warning-light: #FFFBEB;
  --error: #DC2626;
  --error-light: #FEF2F2;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", ui-monospace, Menlo, monospace;
  --transition: 150ms ease;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

::selection {
  background-color: var(--accent-light);
  color: var(--accent);
}

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

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
}

h4 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--text);
}

p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

small {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

code {
  font-size: 13px;
  background-color: var(--surface-active);
  color: var(--text);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

pre {
  font-size: 13px;
  background-color: var(--surface-active);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  line-height: 1.7;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* ==========================================================================
   4. SCROLLBAR STYLING
   ========================================================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 3px;
}

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

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

/* ==========================================================================
   5. LAYOUT — LANDING PAGE
   ========================================================================== */

/* Site Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 40px;
  gap: 32px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
  color: var(--text);
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.nav a {
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--transition);
  white-space: nowrap;
}

.nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Hero Section */
.hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 40px;
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.6;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(27, 79, 216, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 720px;
  width: 100%;
}

.hero-title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-title span {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto;
}

.hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background-color: var(--surface);
  white-space: nowrap;
}

.hero-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Features Section */
.features-section {
  padding: 80px 40px;
  max-width: 1120px;
  margin: 0 auto;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: 16px;
  color: var(--text-2);
  max-width: 560px;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.feature-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.feature-icon {
  width: 40px;
  height: 40px;
  background-color: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* How It Works */
/* Shared section inner wrapper (max-width centering) */
.section-inner {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

/* How It Works — HTML uses .how-it-works-section */
.how-it-works,
.how-it-works-section {
  padding: 80px 40px;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.how-it-works-inner {
  max-width: 1120px;
  margin: 0 auto;
}

/* Privacy Section */
.privacy-section {
  padding: 80px 40px;
  background-color: var(--accent-light);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.privacy-box {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.privacy-box-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--accent-light);
  border-radius: var(--radius-md);
  color: var(--accent);
}

.privacy-box-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.privacy-box-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
}

.privacy-link {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-top: 4px;
}

.privacy-link:hover {
  text-decoration: underline;
}

/* Browser Compatibility Section */
.compat-section {
  padding: 80px 40px;
  background-color: var(--bg);
}

.compat-table-wrapper {
  overflow-x: auto;
  margin-top: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.compat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.compat-table th,
.compat-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.compat-table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background-color: var(--surface-hover);
}

.compat-table tr:last-child td {
  border-bottom: none;
}

.compat-table td:first-child {
  font-weight: 500;
  color: var(--text);
}

.compat-full {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
}

.compat-full::before {
  content: "✓";
  font-weight: 700;
}

.compat-partial {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--warning);
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 32px;
  margin-top: 48px;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background-color: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.step p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* FAQ Section */
.faq-section {
  padding: 80px 40px;
  max-width: 720px;
  margin: 0 auto;
}

.faq-list {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 20px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  transition: color var(--transition);
}

.faq-question:hover {
  color: var(--accent);
}

.faq-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform var(--transition);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  padding-bottom: 20px;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

/* Site Footer */
.site-footer {
  border-top: 1px solid var(--border);
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 40px;
  gap: 24px;
}

.site-footer p,
.site-footer span {
  font-size: 13px;
  color: var(--text-3);
}

.site-footer a {
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer a:hover {
  color: var(--text-2);
  text-decoration: none;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.footer-brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-meta {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  margin-left: auto;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

/* ==========================================================================
   6. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  flex-shrink: 0;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--accent-hover);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-secondary:active:not(:disabled) {
  background-color: var(--surface-active);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--surface-hover);
  color: var(--text);
}

.btn-ghost:active:not(:disabled) {
  background-color: var(--surface-active);
}

.btn-danger {
  background-color: var(--error);
  color: #ffffff;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

.btn-danger:active:not(:disabled) {
  background-color: #991b1b;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-sm svg {
  width: 12px;
  height: 12px;
}

.btn-lg {
  height: 40px;
  padding: 0 16px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.btn-lg svg {
  width: 16px;
  height: 16px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-icon.btn-lg {
  width: 40px;
  height: 40px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button loading state */
.btn.loading {
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: inherit;
}

.btn-primary.loading::after {
  border-top-color: rgba(255, 255, 255, 0.8);
}

.btn-secondary.loading::after,
.btn-ghost.loading::after {
  border-top-color: var(--text-2);
}

/* ==========================================================================
   7. WORKSPACE LAYOUT
   ========================================================================== */

.workspace {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  flex-direction: column;
  background-color: var(--bg);
  overflow: hidden;
}

.workspace.active,
body.workspace-active .workspace {
  display: flex;
}

.landing {
  display: block;
}

body.workspace-active .landing {
  display: none;
}

.workspace-header {
  height: 48px;
  min-height: 48px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0;
  gap: 0;
  flex-shrink: 0;
  z-index: 10;
  overflow: hidden;
}

.workspace-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  flex-shrink: 0;
}

.workspace-tabs {
  flex: 1;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-width: 0;
}

.workspace-tabs::-webkit-scrollbar {
  display: none;
}

.workspace-tabs .tab {
  height: 100%;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
}

.workspace-tabs .tab:hover {
  color: var(--text);
}

.workspace-tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.workspace-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
}

.workspace-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

/* Pane Left */
.pane-left {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  border-right: 1px solid var(--border);
  background-color: var(--surface);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition), min-width var(--transition), opacity var(--transition);
}

.pane-left.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
  opacity: 0;
}

/* Pane Center */
.pane-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Pane Right */
.pane-right {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  border-left: 1px solid var(--border);
  background-color: var(--surface);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition), min-width var(--transition), opacity var(--transition);
}

.pane-right.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: none;
  opacity: 0;
}

/* Pane Toggle */
.pane-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
  flex-shrink: 0;
}

.pane-toggle:hover {
  background-color: var(--surface-hover);
  color: var(--text-2);
}

.pane-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition);
}

.pane-toggle.toggled svg {
  transform: rotate(180deg);
}

/* ==========================================================================
   8. TOOLBAR
   ========================================================================== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface);
  flex-shrink: 0;
  min-height: 44px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.toolbar-group + .toolbar-group {
  padding-left: 8px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

.toolbar-spacer {
  flex: 1;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-icon {
  position: absolute;
  left: 8px;
  width: 14px;
  height: 14px;
  color: var(--text-3);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  width: 200px;
  height: 30px;
  padding: 0 8px 0 30px;
  font-size: 13px;
  color: var(--text);
  background-color: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
  outline: none;
}

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

.search-input:focus {
  background-color: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 79, 216, 0.1);
}

/* ==========================================================================
   9. FILE TABLE
   ========================================================================== */

.file-table-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
}

.file-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}

.file-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--surface);
}

.file-table thead::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--border);
}

.file-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 16px;
  height: 36px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: color var(--transition);
}

.file-table th:hover {
  color: var(--text-2);
}

.file-table th.sort-asc,
.file-table th.sort-desc {
  color: var(--text);
}

.file-table th .sort-indicator {
  display: inline-flex;
  margin-left: 4px;
  opacity: 0.5;
}

.file-table th.sort-asc .sort-indicator,
.file-table th.sort-desc .sort-indicator {
  opacity: 1;
  color: var(--accent);
}

.file-table th:first-child {
  width: 40px;
  padding: 0 8px;
}

.file-table td {
  font-size: 14px;
  color: var(--text);
  padding: 0 16px;
  height: 36px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.file-table td:first-child {
  width: 40px;
  padding: 0 8px;
}

.file-table tbody tr {
  transition: background-color var(--transition);
}

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

.file-table tbody tr.selected {
  background-color: var(--accent-light);
  box-shadow: inset 2px 0 0 var(--accent);
}

.file-table tbody tr.selected:hover {
  background-color: #e4eafb;
}

.file-table tbody tr:last-child td {
  border-bottom: none;
}

/* Checkbox column */
.file-table .row-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* File name cell */
.file-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-3);
}

.file-icon.icon-image { color: #8b5cf6; }
.file-icon.icon-video { color: #ef4444; }
.file-icon.icon-audio { color: #f97316; }
.file-icon.icon-pdf   { color: #dc2626; }
.file-icon.icon-doc   { color: #2563eb; }
.file-icon.icon-sheet { color: #16a34a; }
.file-icon.icon-code  { color: #0891b2; }
.file-icon.icon-archive { color: #d97706; }
.file-icon.icon-folder  { color: #f59e0b; }

.file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.file-ext-badge {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background-color: var(--surface-active);
  color: var(--text-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  flex: 1;
  min-height: 320px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--text-3);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-3);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ==========================================================================
   10. LEFT PANEL — FILE TREE
   ========================================================================== */

.tree {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tree-section-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 8px;
  margin-top: 8px;
  margin-bottom: 2px;
}

.tree-item {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 8px 0 12px;
  gap: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  transition: background-color var(--transition), color var(--transition);
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.tree-item:hover {
  background-color: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.tree-item.active {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.tree-item.active:hover {
  background-color: #e4eafb;
}

.tree-item-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: inherit;
}

.tree-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-expand {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  border-radius: 2px;
  flex-shrink: 0;
  transition: transform var(--transition);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.tree-expand:hover {
  color: var(--text-2);
}

.tree-expand svg {
  width: 10px;
  height: 10px;
}

.tree-item.expanded > .tree-expand {
  transform: rotate(90deg);
}

.tree-children {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tree-children.hidden {
  display: none;
}

/* ==========================================================================
   11. RIGHT PANEL — PREVIEW
   ========================================================================== */

.preview-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.preview-header {
  height: 40px;
  min-height: 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
}

.preview-filename {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.preview-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  flex-shrink: 0;
  transition: background-color var(--transition), color var(--transition);
}

.preview-close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}

.preview-close svg {
  width: 14px;
  height: 14px;
}

.preview-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.preview-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  padding: 16px;
}

.preview-text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  padding: 16px;
  background-color: var(--bg);
  min-height: 100%;
}

.preview-text-line {
  display: flex;
  gap: 12px;
}

.preview-text-line-number {
  color: var(--text-3);
  text-align: right;
  min-width: 32px;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}

.preview-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.preview-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  background-color: var(--surface-hover);
  padding: 6px 12px;
  border: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.preview-table td {
  padding: 6px 12px;
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

.preview-table tbody tr:hover td {
  background-color: var(--surface-hover);
}

.preview-audio {
  width: 100%;
  padding: 24px;
}

.preview-audio audio {
  width: 100%;
  border-radius: var(--radius-md);
}

.preview-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  min-height: 200px;
  gap: 12px;
}

.preview-unsupported svg {
  width: 40px;
  height: 40px;
  color: var(--text-3);
}

.preview-unsupported p {
  font-size: 13px;
  color: var(--text-3);
}

.preview-meta {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.preview-meta-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.preview-meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.preview-meta-row:last-child {
  border-bottom: none;
}

.preview-meta-key {
  font-size: 12px;
  color: var(--text-3);
  min-width: 80px;
  flex-shrink: 0;
}

.preview-meta-value {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
   12. MODULE PANELS (Archive, Rename, Metadata, Recipes)
   ========================================================================== */

/* Wrapper for each module view — fills center pane completely */
[data-module-panel] {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

[data-module-panel]:not([hidden]) {
  display: flex;
}

.module-panel {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#file-table-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.module-header {
  margin-bottom: 24px;
}

.module-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.module-header p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.module-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.module-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-hover);
}

.module-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.module-section-body {
  padding: 16px;
}

/* Rename Rule */
.rename-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.rename-rule-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 80px;
}

.rename-rule-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

/* Rename Preview Table */
.rename-preview-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin-top: 12px;
}

.rename-preview-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 12px;
  background-color: var(--surface-hover);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.rename-preview-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.rename-preview-table tbody tr:last-child td {
  border-bottom: none;
}

.rename-preview-before {
  color: var(--text-2);
  font-family: var(--font-mono);
}

.rename-preview-after {
  color: var(--success);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Progress Bar */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background-color: var(--surface-active);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--accent);
  border-radius: 3px;
  transition: width 200ms ease;
  position: relative;
  overflow: hidden;
}

.progress-bar.indeterminate {
  width: 40% !important;
  animation: progress-indeterminate 1.4s ease infinite;
}

@keyframes progress-indeterminate {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(350%); }
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-2);
}

/* Archive Drop Zone */
.archive-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.archive-drop-zone:hover,
.archive-drop-zone.drag-over {
  border-color: var(--accent);
  background-color: var(--accent-light);
}

.archive-drop-zone svg {
  width: 32px;
  height: 32px;
  color: var(--text-3);
}

.archive-drop-zone.drag-over svg {
  color: var(--accent);
}

.archive-drop-zone p {
  font-size: 14px;
  color: var(--text-2);
}

.archive-drop-zone span {
  font-size: 12px;
  color: var(--text-3);
}

/* ==========================================================================
   13. FORMS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

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

.input,
.select,
.textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:hover:not(:disabled):not(:read-only),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 79, 216, 0.1);
  background-color: var(--surface);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--surface-hover);
}

.input:read-only {
  background-color: var(--surface-hover);
  color: var(--text-2);
  cursor: default;
}

.textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239A9896' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

/* Input Group (icon prefix/suffix) */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  width: 100%;
}

.input-group-prefix,
.input-group-suffix {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: var(--text-3);
}

.input-group-prefix {
  left: 10px;
}

.input-group-suffix {
  right: 10px;
}

.input-group-prefix svg,
.input-group-suffix svg {
  width: 14px;
  height: 14px;
}

.input-group .input-has-prefix {
  padding-left: 32px;
}

.input-group .input-has-suffix {
  padding-right: 32px;
}

/* Checkbox */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.checkbox {
  width: 14px;
  height: 14px;
  min-width: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
  position: relative;
}

.checkbox:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.checkbox:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath fill='%23fff' d='M1 3.5L3.5 6 9 1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

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

.checkbox-label {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* Radio */
.radio-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.radio {
  width: 14px;
  height: 14px;
  min-width: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background-color: var(--surface);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
  position: relative;
}

.radio:checked {
  border-color: var(--accent);
  background-color: var(--surface);
}

.radio:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

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

.radio-label {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.toggle {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background-color: var(--border-strong);
  border-radius: 9px;
  transition: background-color var(--transition);
  cursor: pointer;
}

.toggle input:checked ~ .toggle-track {
  background-color: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.toggle input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(14px);
}

.toggle input:focus-visible ~ .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-label {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* Validation States */
.input.input-error,
.select.input-error,
.textarea.input-error {
  border-color: var(--error);
  background-color: var(--error-light);
}

.input.input-error:focus,
.select.input-error:focus,
.textarea.input-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input.input-success,
.select.input-success,
.textarea.input-success {
  border-color: var(--success);
}

.input.input-success:focus,
.select.input-success:focus,
.textarea.input-success:focus {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.form-error {
  font-size: 12px;
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-error svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.form-success {
  font-size: 12px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   14. MODALS & OVERLAYS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background-color: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* opened programmatically by removing [hidden] */
.modal-overlay:not([hidden]) {
  display: flex;
  animation: fadeIn 120ms ease forwards;
}

.modal {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  animation: slideUp 150ms ease forwards;
}

.modal-sm { max-width: 360px; }
.modal-lg { max-width: 640px; }
.modal-xl { max-width: 800px; }

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

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  transition: background-color var(--transition), color var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background-color: var(--surface-hover);
  color: var(--text);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-body p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}

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

.modal-footer-left {
  margin-right: auto;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideUp 150ms ease forwards;
  font-size: 13px;
  line-height: 1.5;
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.toast-message {
  color: var(--text-2);
  font-size: 12px;
}

.toast-dismiss {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  flex-shrink: 0;
  transition: background-color var(--transition);
}

.toast-dismiss:hover {
  background-color: var(--surface-hover);
  color: var(--text-2);
}

.toast-dismiss svg {
  width: 12px;
  height: 12px;
}

.toast-success {
  border-left: 3px solid var(--success);
}

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

.toast-error {
  border-left: 3px solid var(--error);
}

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

.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-info .toast-icon {
  color: var(--accent);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

/* ==========================================================================
   15. TAGS & BADGES
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-default {
  background-color: var(--surface-active);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.badge-accent {
  background-color: var(--accent-light);
  color: var(--accent);
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background-color: var(--warning-light);
  color: var(--warning);
}

.badge-error {
  background-color: var(--error-light);
  color: var(--error);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 6px 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background-color: var(--surface-active);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: background-color var(--transition), color var(--transition);
  flex-shrink: 0;
}

.tag-remove:hover {
  background-color: var(--border-strong);
  color: var(--text);
}

.tag-remove svg {
  width: 10px;
  height: 10px;
}

.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* ==========================================================================
   16. TABS
   ========================================================================== */

.tabs {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  gap: 0;
  padding: 0 16px;
  overflow-x: auto;
  flex-shrink: 0;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;
}

.tab:hover {
  color: var(--text-2);
  text-decoration: none;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.tabs-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-panel {
  display: none;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   17. KEYBOARD SHORTCUTS
   ========================================================================== */

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 var(--border);
  white-space: nowrap;
  line-height: 1;
}

.kbd-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ==========================================================================
   18. BROWSER SUPPORT PANEL
   ========================================================================== */

.support-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.support-grid th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-hover);
}

.support-grid td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.support-grid tbody tr:last-child td {
  border-bottom: none;
}

.support-yes,
.support-partial,
.support-no {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.support-yes::before,
.support-partial::before,
.support-no::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.support-yes {
  color: var(--success);
}

.support-yes::before {
  background-color: var(--success);
}

.support-partial {
  color: var(--warning);
}

.support-partial::before {
  background-color: var(--warning);
}

.support-no {
  color: var(--error);
}

.support-no::before {
  background-color: var(--error);
}

/* ==========================================================================
   19. LOADING STATES
   ========================================================================== */

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-hover) 0%,
    var(--surface-active) 50%,
    var(--surface-hover) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.skeleton-text:last-child {
  margin-bottom: 0;
  width: 60%;
}

.skeleton-title {
  height: 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  width: 40%;
}

.skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Full-pane Loading Overlay */
.overlay-loading {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.overlay-loading p {
  font-size: 13px;
  color: var(--text-2);
}

/* ==========================================================================
   20. ANIMATIONS & KEYFRAMES
   ========================================================================== */

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

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.animate-fade-in {
  animation: fadeIn 200ms ease forwards;
}

.animate-slide-up {
  animation: slideUp 200ms ease forwards;
}

/* IntersectionObserver reveal class */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 400ms ease, transform 400ms ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

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

  .reveal,
  .reveal.revealed {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .skeleton {
    animation: none;
    background: var(--surface-hover);
  }

  .progress-bar.indeterminate {
    animation: none;
    width: 50% !important;
  }
}

/* ==========================================================================
   21. RESPONSIVE / MOBILE
   ========================================================================== */

@media (max-width: 768px) {
  /* Header */
  .site-header {
    padding: 0 16px;
    gap: 16px;
  }

  .nav {
    display: none;
  }

  /* Hero */
  .hero {
    padding: 48px 24px;
    min-height: 70vh;
  }

  /* Sections */
  .features-section,
  .how-it-works,
  .how-it-works-section,
  .privacy-section,
  .compat-section {
    padding: 48px 24px;
  }

  .faq-section {
    padding: 48px 24px;
  }

  .how-it-works .how-it-works-inner,
  .how-it-works-section .section-inner {
    padding: 0;
  }

  .privacy-box {
    flex-direction: column;
    gap: 16px;
    padding: 24px;
  }

  .steps-list {
    grid-template-columns: 1fr;
    gap: 24px;
  }

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

  /* Footer */
  .site-footer {
    height: auto;
    min-height: 48px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .footer-links {
    margin-left: 0;
    flex-wrap: wrap;
    gap: 12px;
  }

  /* Workspace — single column */
  .workspace-body {
    flex-direction: column;
    position: relative;
  }

  .pane-left {
    position: fixed;
    left: 0;
    top: 48px;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    box-shadow: var(--shadow-lg);
  }

  .pane-left.mobile-open {
    transform: translateX(0);
  }

  .pane-left.collapsed {
    transform: translateX(-100%);
    width: 280px;
    min-width: 280px;
    opacity: 1;
  }

  .pane-right {
    position: fixed;
    right: 0;
    top: 48px;
    bottom: 64px;
    z-index: 150;
    transform: translateX(100%);
    transition: transform 200ms ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-shadow: var(--shadow-lg);
  }

  .pane-right.mobile-open {
    transform: translateX(0);
  }

  .pane-right.collapsed {
    transform: translateX(100%);
    width: 100%;
    opacity: 1;
  }

  .pane-center {
    flex: 1;
  }

  /* Mobile overlay behind open panes */
  .pane-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 140;
    background-color: rgba(0, 0, 0, 0.25);
  }

  .pane-overlay.active {
    display: block;
  }

  /* Mobile bottom action bar */
  .mobile-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 160;
    padding: 0 8px;
  }

  .mobile-action-bar .btn {
    flex-direction: column;
    gap: 3px;
    height: auto;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-3);
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-action-bar .btn.active {
    color: var(--accent);
  }

  .mobile-action-bar .btn svg {
    width: 20px;
    height: 20px;
  }

  /* Touch-friendly tap targets */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .btn.btn-sm {
    min-height: 44px;
  }

  .tree-item {
    height: 40px;
    min-height: 40px;
  }

  .file-table td,
  .file-table th {
    min-height: 44px;
    height: 44px;
  }

  .tab {
    height: 44px;
    min-height: 44px;
  }

  /* Modal full screen on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
  }

  /* Search input wider */
  .search-input {
    width: 100%;
  }

  /* Toast full width */
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 76px;
    max-width: none;
  }
}

@media (min-width: 769px) {
  .mobile-action-bar {
    display: none;
  }

  .pane-overlay {
    display: none !important;
  }
}

/* ==========================================================================
   22. UTILITIES
   ========================================================================== */

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Text truncation */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Text color utilities */
.text-muted   { color: var(--text-2); }
.text-subtle  { color: var(--text-3); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error   { color: var(--error); }

/* Flexbox utilities */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.flex-row       { flex-direction: row; }
.flex-wrap      { flex-wrap: wrap; }
.flex-1         { flex: 1; }
.flex-shrink-0  { flex-shrink: 0; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.justify-start   { justify-content: flex-start; }

/* Gap utilities */
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.gap-8  { gap: 32px; }

/* Margin-top utilities */
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mt-10 { margin-top: 40px; }
.mt-12 { margin-top: 48px; }

/* Margin-bottom utilities */
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.mb-8  { margin-bottom: 32px; }
.mb-10 { margin-bottom: 40px; }
.mb-12 { margin-bottom: 48px; }

/* Padding utilities */
.p-2   { padding: 8px; }
.p-3   { padding: 12px; }
.p-4   { padding: 16px; }
.p-6   { padding: 24px; }
.p-8   { padding: 32px; }

/* Width utilities */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-w-0 { min-width: 0; }

/* Display utilities */
.hidden  { display: none; }
.block   { display: block; }
.inline  { display: inline; }
.inline-flex { display: inline-flex; }

/* Overflow utilities */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }

/* Border radius utilities */
.rounded    { border-radius: var(--radius-md); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

/* Font weight utilities */
.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* Font size utilities */
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.text-base { font-size: 14px; }
.text-md  { font-size: 15px; }
.text-lg  { font-size: 16px; }

/* Mono font */
.font-mono { font-family: var(--font-mono); }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.pointer-events-none { pointer-events: none; }

/* Separator / divider */
.divider {
  height: 1px;
  background-color: var(--border);
  margin: 8px 0;
}

.divider-vertical {
  width: 1px;
  height: 16px;
  background-color: var(--border);
  flex-shrink: 0;
}

/* ==========================================================================
   23. CONTEXT MENU
   ========================================================================== */

.context-menu {
  position: fixed;
  z-index: 500;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 180px;
  animation: fadeIn 100ms ease forwards;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  transition: background-color var(--transition);
  white-space: nowrap;
}

.context-menu-item:hover {
  background-color: var(--surface-hover);
}

.context-menu-item.danger {
  color: var(--error);
}

.context-menu-item.danger:hover {
  background-color: var(--error-light);
}

.context-menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-3);
}

.context-menu-item.danger svg {
  color: var(--error);
}

.context-menu-separator {
  height: 1px;
  background-color: var(--border);
  margin: 4px 0;
}

.context-menu-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 10px 2px;
}

/* ==========================================================================
   24. DROPDOWN
   ========================================================================== */

.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 160px;
  animation: fadeIn 100ms ease forwards;
}

.dropdown-menu.align-right {
  left: auto;
  right: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  transition: background-color var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-item:hover {
  background-color: var(--surface-hover);
  text-decoration: none;
  color: var(--text);
}

.dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-3);
}

.dropdown-separator {
  height: 1px;
  background-color: var(--border);
  margin: 4px 0;
}

/* ==========================================================================
   25. TOOLTIP
   ========================================================================== */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 600;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ==========================================================================
   26. STATUS BAR
   ========================================================================== */

.status-bar {
  height: 24px;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  flex-shrink: 0;
}

.status-bar-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.status-bar-item svg {
  width: 11px;
  height: 11px;
}

.status-bar-spacer {
  flex: 1;
}

/* ==========================================================================
   RECIPES MODULE
   ========================================================================== */

.recipes-module {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.recipes-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.recipes-heading {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.recipes-subtitle {
  font-size: 13px;
  color: var(--text-2);
}

.recipes-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.recipes-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipes-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.recipe-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.recipe-card--starter {
  background: var(--accent-light);
  border-color: #c7d7fa;
}

.recipe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.recipe-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.recipe-type-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-active);
  color: var(--text-2);
  white-space: nowrap;
}

.recipe-type-rename  { background: #FFF3CD; color: #92400E; }
.recipe-type-archive { background: #D1FAE5; color: #065F46; }
.recipe-type-metadata-export { background: #E0E7FF; color: #3730A3; }
.recipe-type-custom  { background: var(--surface-active); color: var(--text-2); }

.recipe-description {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
}

.recipe-meta {
  font-size: 11px;
  color: var(--text-3);
}

.recipe-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.recipes-empty {
  grid-column: 1 / -1;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop:not([hidden]) {
  display: flex;
  animation: fadeIn 120ms ease forwards;
}

.recipes-modal {
  width: min(480px, calc(100vw - 48px));
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  margin-top: 4px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,79,216,0.12);
}

.form-textarea--mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin: 4px 0 6px;
}

.form-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 8px;
}

.required {
  color: var(--error);
}

/* ==========================================================================
   ARCHIVE MODULE — additional rules
   ========================================================================== */

.archive-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 0;
  max-height: 220px;
  overflow-y: auto;
}

.archive-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.archive-input {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  margin-top: 4px;
  transition: border-color var(--transition);
}

.archive-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,79,216,0.12);
}

.extract-results-tree {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
}

.extract-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.extract-result-item:last-child {
  border-bottom: none;
}

/* ==========================================================================
   METADATA MODULE — additional rules
   ========================================================================== */

.metadata-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 16px;
}

.metadata-results-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.metadata-results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ==========================================================================
   LEGAL PAGES
   ========================================================================== */

.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

.legal-page h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 32px;
}

.legal-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

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

.legal-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.legal-section p,
.legal-section li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 8px;
}

.legal-section a {
  color: var(--accent);
  text-decoration: none;
}

.legal-section a:hover {
  text-decoration: underline;
}

.legal-section address {
  font-style: normal;
  line-height: 1.8;
  color: var(--text-2);
}

/* ==========================================================================
   ARCHIVE MODULE — layout and tab styles
   ========================================================================== */

.archive-convert-desc {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
}

.archive-module {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.archive-tabs {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.archive-tab {
  padding: 0 20px;
  height: 40px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.archive-tab:hover {
  color: var(--text);
}

.archive-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.archive-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.archive-panel[hidden] {
  display: none;
}

.archive-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.archive-dropzone:hover,
.archive-dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 14px;
}

.dropzone-inner svg {
  color: var(--text-3);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.archive-file-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
}

.archive-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.archive-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  gap: 8px;
}

.archive-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-file-size {
  color: var(--text-3);
  font-size: 12px;
  flex-shrink: 0;
}

.archive-create-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
}

.archive-label input[type="checkbox"] {
  margin-right: 6px;
}

.archive-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.archive-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.archive-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 150ms ease;
}

.archive-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-warning {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #92400E;
}

.extract-selected-info,
#convert-selected-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.extract-results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
  flex-wrap: wrap;
}

.extract-tree {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.extract-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 8px;
}

.extract-tree-item:last-child {
  border-bottom: none;
}

.extract-file-path {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.extract-file-size {
  color: var(--text-3);
  font-size: 12px;
  flex-shrink: 0;
}
