/* ==========================================================================
   Content Downloader Web — PWA stylesheet
   Tema gelap profesional, responsif 360px–1440px, target sentuh >= 44px.
   ========================================================================== */

:root {
  --bg: #0b1220;
  --bg-2: #0d1626;
  --surface: #121c30;
  --surface-2: #17233c;
  --surface-3: #1d2b48;
  --border: #24314f;
  --border-soft: rgba(255, 255, 255, 0.06);

  --text: #e8eef9;
  --text-2: #a3b2cd;
  --text-3: #6f7f9f;

  --primary: #4f7cff;
  --primary-2: #2fb6ff;
  --primary-soft: rgba(79, 124, 255, 0.15);
  --primary-ring: rgba(79, 124, 255, 0.35);

  --success: #2fd47f;
  --success-soft: rgba(47, 212, 127, 0.14);
  --danger: #ff5c6c;
  --danger-soft: rgba(255, 92, 108, 0.14);
  --warn: #ffb454;
  --warn-soft: rgba(255, 180, 84, 0.15);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.15);

  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 18px 46px -18px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 6px 18px -10px rgba(0, 0, 0, 0.8);

  --sidebar-w: 252px;
  --touch: 46px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 12% -8%, rgba(79, 124, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(47, 182, 255, 0.1), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p {
  margin: 0;
}

a {
  color: var(--primary-2);
}

img {
  display: block;
  max-width: 100%;
}

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

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

.muted { color: var(--text-2); }
.small { font-size: 0.82rem; }
[hidden] { display: none !important; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.06s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #06101f;
  font-weight: 700;
  box-shadow: 0 10px 24px -10px var(--primary-ring);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 30px -8px var(--primary-ring); }

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

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(255, 92, 108, 0.35);
}
.btn-danger:hover:not(:disabled) { background: rgba(255, 92, 108, 0.22); }

.btn-block { width: 100%; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 1rem; }

.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn-primary.is-loading::after {
  border-color: rgba(6, 16, 31, 0.3);
  border-top-color: #06101f;
}

/* compact icon-ish buttons used inside list rows */
.btn-sm {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.84rem;
  border-radius: 8px;
}
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--primary-2);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  max-width: 100%;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-link:hover { background: var(--primary-soft); border-color: var(--primary-ring); }
.btn-link .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

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

/* ==========================================================================
   Forms
   ========================================================================== */
.field {
  display: block;
  margin-bottom: 16px;
}
.field-label,
.field > label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: #2f3f63; }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[readonly] {
  color: var(--text-2);
  background: var(--bg-2);
  cursor: default;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a3b2cd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}
select option { background: var(--surface); color: var(--text); }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .eye-off { display: none; }
.password-toggle.is-visible .eye-on { display: none; }
.password-toggle.is-visible .eye-off { display: block; }

/* ==========================================================================
   Badges / chips / alerts
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-platform { background: var(--surface-3); color: var(--text); }
.badge-youtube { background: rgba(255, 60, 60, 0.14); color: #ff8a8a; }
.badge-instagram { background: rgba(225, 48, 108, 0.16); color: #ff8fc0; }
.badge-facebook { background: rgba(59, 123, 246, 0.18); color: #8ab4ff; }
.badge-tiktok { background: rgba(37, 244, 238, 0.14); color: #7ff5f2; }
.badge-youtube::before,
.badge-instagram::before,
.badge-facebook::before,
.badge-tiktok::before { background: currentColor; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}
.chip-queued { background: var(--warn-soft); color: var(--warn); }
.chip-running { background: var(--info-soft); color: var(--info); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-failed { background: var(--danger-soft); color: var(--danger); }
.chip-cancelled { background: var(--surface-3); color: var(--text-2); }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--danger-soft);
  color: #ffb4bb;
  border-color: rgba(255, 92, 108, 0.32);
}
.alert-success {
  background: var(--success-soft);
  color: #93f0be;
  border-color: rgba(47, 212, 127, 0.3);
}

/* ==========================================================================
   Login page
   ========================================================================== */
.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
  padding: 34px 30px 30px;
  background: linear-gradient(180deg, rgba(23, 35, 60, 0.95), rgba(18, 28, 48, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.auth-logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 26px -10px rgba(79, 124, 255, 0.6);
}
.auth-logo img { width: 68px; height: 68px; }
.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
}
.auth-sub {
  margin: 6px 0 24px;
  text-align: center;
  color: var(--text-2);
  font-size: 0.92rem;
}
.auth-foot {
  margin-top: 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.78rem;
  min-height: 1em;
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 16px 18px;
  background: rgba(13, 22, 38, 0.82);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 8px;
}
.sidebar-brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 8px 18px -8px rgba(79, 124, 255, 0.7);
}
.brand-name {
  display: block;
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub {
  display: block;
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--touch);
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { width: 20px; height: 20px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active {
  background: var(--primary-soft);
  color: #cfe0ff;
  box-shadow: inset 0 0 0 1px var(--primary-ring);
}
.nav-item.is-active svg { opacity: 1; color: var(--primary-2); }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border-soft); }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 0 26px;
  background: rgba(11, 18, 32, 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.topbar-title h1 {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.conn-dot.is-offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.content {
  padding: 26px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  flex: 1;
}

.section { animation: fade 0.16s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-head h2 {
  font-size: 1.05rem;
  font-weight: 800;
}
.section-head p { color: var(--text-2); font-size: 0.86rem; margin-top: 3px; }

/* ==========================================================================
   Cards & stats
   ========================================================================== */
.card {
  background: linear-gradient(180deg, rgba(23, 35, 60, 0.72), rgba(18, 28, 48, 0.72));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }

.grid { display: grid; gap: 14px; }
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}
.stat {
  position: relative;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(23, 35, 60, 0.78), rgba(18, 28, 48, 0.7));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--stat-accent, var(--primary));
}
.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-label { color: var(--text-2); font-size: 0.8rem; font-weight: 600; }
.stat-ico {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--stat-soft, var(--primary-soft));
  color: var(--stat-accent, var(--primary-2));
}
.stat-ico svg { width: 18px; height: 18px; }
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-sub { margin-top: 6px; color: var(--text-3); font-size: 0.76rem; }

.stat.total { --stat-accent: var(--primary-2); --stat-soft: var(--primary-soft); }
.stat.success { --stat-accent: var(--success); --stat-soft: var(--success-soft); }
.stat.failed { --stat-accent: var(--danger); --stat-soft: var(--danger-soft); }
.stat.active { --stat-accent: var(--info); --stat-soft: var(--info-soft); }

.storage-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(79, 124, 255, 0.12), rgba(47, 182, 255, 0.06));
  border: 1px solid var(--border);
}
.storage-main { min-width: 180px; }
.storage-amount {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.storage-label { color: var(--text-2); font-size: 0.8rem; font-weight: 600; margin-top: 2px; }
.storage-meter {
  flex: 1;
  min-width: 160px;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.storage-meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.5s ease;
}
.platform-breakdown { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==========================================================================
   Unduhan Baru
   ========================================================================== */
.url-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  margin: -6px 0 14px;
}
.download-form .btn-lg { width: 100%; }
.form-actions { margin-top: 4px; }

/* ==========================================================================
   Job aktif
   ========================================================================== */
.jobs { display: grid; gap: 12px; }
.job {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.job-titles { min-width: 0; }
.job-title {
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.job-url {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-head .badge { flex: none; }

.job-progress {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin: 4px 0 10px;
}
.job-progress span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.4s ease;
}
.job.is-queued .job-progress span {
  width: 38% !important;
  background: linear-gradient(90deg, transparent, var(--info), transparent);
  animation: indet 1.2s ease-in-out infinite;
}
@keyframes indet {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.job-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.job-msg {
  color: var(--text-2);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-pct { color: var(--text-3); font-size: 0.78rem; font-variant-numeric: tabular-nums; margin-left: auto; }

/* ==========================================================================
   Riwayat
   ========================================================================== */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
table.history {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.history thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.history tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
table.history tbody tr:last-child td { border-bottom: 0; }
table.history tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.col-time { white-space: nowrap; color: var(--text-2); font-size: 0.82rem; }
.col-title { min-width: 180px; }
.cell-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: 340px; }
.cell-files { display: flex; flex-direction: column; gap: 6px; }
.cell-error {
  color: var(--danger);
  font-size: 0.76rem;
  line-height: 1.35;
  margin-top: 3px;
}
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.col-size { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }

.history-cards { display: none; grid-template-columns: 1fr; gap: 12px; }
.hcard {
  padding: 15px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.hcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.hcard-time { color: var(--text-3); font-size: 0.76rem; }
.hcard-title {
  font-weight: 700;
  font-size: 0.93rem;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.hcard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--text-3);
  font-size: 0.78rem;
  margin-bottom: 10px;
}
.hcard-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.hcard-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.012);
}
.empty-state svg { width: 34px; height: 34px; opacity: 0.6; }
.empty-state strong { color: var(--text-2); font-size: 0.95rem; }
.empty-state span { font-size: 0.84rem; max-width: 320px; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast-success { background: #16351f; border-color: rgba(47, 212, 127, 0.4); color: #b6f5d1; }
.toast-error { background: #3a1620; border-color: rgba(255, 92, 108, 0.45); color: #ffc2c8; }
.toast-info { background: #13253d; border-color: rgba(56, 189, 248, 0.4); color: #bce9ff; }

/* ==========================================================================
   Bottom navigation (mobile)
   ========================================================================== */
.bottomnav { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .content { padding: 22px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  .content {
    padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    max-width: 720px;
  }
  .topbar { padding: 0 16px; min-height: 58px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* history: table hidden, cards shown */
  .table-wrap { display: none; }
  .history-cards { display: grid; }

  .bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: rgba(13, 22, 38, 0.94);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(12px);
  }
  .bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 54px;
    padding: 4px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-3);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .bnav-item svg { width: 21px; height: 21px; }
  .bnav-item.is-active { color: var(--primary-2); background: var(--primary-soft); }

  .toast-region { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .content { padding: 16px 14px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .card, .job, .hcard { padding: 16px; }
  .auth-card { padding: 28px 20px 24px; }
  .stat { padding: 15px; }
  .stat-value { font-size: 1.5rem; }
  .storage-card { padding: 15px 16px; }
  .job-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .btn-link .file-name { max-width: 120px; }
}

@media (max-width: 360px) {
  .stats { grid-template-columns: 1fr; }
  .bnav-item { font-size: 0.6rem; }
}

@media (min-width: 1440px) {
  .content { padding: 32px; }
}

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