:root {
  --bg: #f4f6f8;
  --bg-soft: #eef1f4;

  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;

  --ink: #111418;
  --ink-soft: #2c333a;

  --muted: #737b85;
  --muted-2: #9aa2ab;

  --line: #e4e8ec;
  --line-strong: #d9dee4;

  --accent: #111418;
  --accent-soft: #1b2026;

  --success: #177245;
  --success-bg: #eaf8ef;

  --warning: #9a6400;
  --warning-bg: #fff7df;

  --danger: #bd2d2d;
  --danger-bg: #fff0f0;

  --info: #1e5d8f;
  --info-bg: #edf6ff;

  --shadow-sm: 0 8px 24px rgba(19, 30, 42, 0.05);
  --shadow: 0 18px 60px rgba(19, 30, 42, 0.08);
  --shadow-lg: 0 28px 80px rgba(19, 30, 42, 0.12);

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;

  --sidebar-width: 280px;

  --transition: 0.2s ease;
}

/* =========================================================
   RESET
========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;

  background:
    radial-gradient(
      circle at 85% 0%,
      rgba(255, 255, 255, 0.95) 0%,
      transparent 30%
    ),
    radial-gradient(
      circle at 15% 100%,
      rgba(232, 236, 241, 0.75) 0%,
      transparent 34%
    ),
    var(--bg);

  color: var(--ink);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

img {
  max-width: 100%;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;

  width: var(--sidebar-width);
  height: 100vh;

  padding: 24px 18px;

  display: flex;
  flex-direction: column;

  background: rgba(255, 255, 255, 0.86);

  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);

  border-right: 1px solid rgba(217, 222, 228, 0.9);

  box-shadow: 18px 0 55px rgba(20, 28, 38, 0.04);

  z-index: 100;
}

/* =========================================================
   BRAND
========================================================= */

.brand {
  display: flex;
  align-items: center;
  gap: 13px;

  padding: 4px 6px 26px;
}

.brand-mark {
  width: 44px;
  height: 44px;

  display: grid;
  place-items: center;

  flex: 0 0 auto;

  border-radius: 14px;

  background: linear-gradient(145deg, #111418, #2a3139);

  color: #ffffff;

  font-size: 17px;
  font-weight: 850;

  box-shadow: 0 10px 25px rgba(17, 20, 24, 0.17);
}

.brand-mark.small {
  width: 36px;
  height: 36px;

  border-radius: 11px;

  font-size: 14px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;

  font-size: 15px;
  font-weight: 800;

  letter-spacing: -0.01em;
}

.brand-copy span {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 11px;
}

/* =========================================================
   SIDEBAR NAVIGATION
========================================================= */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-link,
.link-button {
  min-height: 46px;

  display: flex;
  align-items: center;
  gap: 11px;

  width: 100%;

  padding: 10px 12px;

  border: 1px solid transparent;
  border-radius: 13px;

  background: transparent;

  color: #5d6670;

  font-size: 13px;
  font-weight: 700;

  cursor: pointer;

  transition:
    background var(--transition),
    color var(--transition),
    border var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

.nav-link:hover,
.link-button:hover {
  background: rgba(244, 246, 248, 0.95);

  color: var(--ink);

  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(145deg, #111418, #20262d);

  color: #ffffff;

  border-color: rgba(17, 20, 24, 0.9);

  box-shadow: 0 10px 26px rgba(17, 20, 24, 0.14);
}

.nav-icon {
  width: 28px;
  height: 28px;

  display: inline-grid;
  place-items: center;

  flex: 0 0 auto;

  border-radius: 9px;

  background: rgba(17, 20, 24, 0.05);

  font-size: 12px;
  font-weight: 900;
}

.nav-link.active .nav-icon {
  background: rgba(255, 255, 255, 0.12);

  color: #ffffff;
}

/* =========================================================
   SIDEBAR BOTTOM
========================================================= */

.sidebar-bottom {
  margin-top: auto;

  display: grid;
  gap: 12px;
}

.system-card {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 13px;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: rgba(248, 250, 252, 0.88);
}

.system-dot {
  width: 9px;
  height: 9px;

  flex: 0 0 auto;

  border-radius: 999px;

  background: #2ea56a;

  box-shadow: 0 0 0 5px rgba(46, 165, 106, 0.1);
}

.system-card strong,
.system-card span {
  display: block;
}

.system-card strong {
  font-size: 12px;
  font-weight: 800;
}

.system-card span {
  margin-top: 2px;

  color: var(--muted);

  font-size: 10px;
}

.logout-button {
  border: 1px solid var(--line);

  background: rgba(255, 255, 255, 0.7);

  color: #6a727c;
}

/* =========================================================
   MAIN SHELL
========================================================= */

.shell {
  margin-left: var(--sidebar-width);

  width: calc(100% - var(--sidebar-width));

  padding: 32px clamp(24px, 4vw, 60px) 64px;

  max-width: 1800px;
}

.auth-shell {
  max-width: 1160px;

  margin: 0 auto;

  padding: 52px 24px;
}

/* =========================================================
   TOPBAR
========================================================= */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 22px;

  margin-bottom: 30px;
}

.topbar-copy {
  min-width: 0;
}

.eyebrow {
  display: inline-block;

  color: var(--muted);

  font-size: 10px;
  font-weight: 850;

  letter-spacing: 0.16em;

  text-transform: uppercase;
}

.topbar h1 {
  margin: 7px 0 0;

  font-size: clamp(30px, 4vw, 48px);

  line-height: 1.05;

  letter-spacing: -0.045em;
}

.topbar-actions {
  display: flex;
  align-items: stretch;

  gap: 10px;

  flex: 0 0 auto;
}

.clock-card,
.profile-chip {
  border: 1px solid rgba(255, 255, 255, 0.92);

  background: rgba(255, 255, 255, 0.78);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: var(--shadow-sm);

  border-radius: 16px;
}

.clock-card {
  min-width: 165px;

  padding: 12px 15px;

  text-align: right;
}

.clock-card span,
.clock-card strong {
  display: block;
}

.clock-card span {
  color: var(--muted);

  font-size: 10px;
}

.clock-card strong {
  margin-top: 2px;

  font-size: 19px;
  font-weight: 800;

  letter-spacing: -0.03em;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 9px 12px;
}

.profile-avatar {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  flex: 0 0 auto;

  border-radius: 12px;

  background: #111418;

  color: #ffffff;

  font-size: 13px;
  font-weight: 850;
}

.profile-copy strong,
.profile-copy span {
  display: block;
}

.profile-copy strong {
  font-size: 12px;
  font-weight: 800;
}

.profile-copy span {
  margin-top: 2px;

  color: var(--muted);

  font-size: 10px;
}

/* =========================================================
   MOBILE HEADER
========================================================= */

.mobile-header {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* =========================================================
   PANELS & SURFACES
========================================================= */

.panel,
.stat,
.template-card,
.auth-card {
  border: 1px solid rgba(255, 255, 255, 0.92);

  background: var(--surface);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  box-shadow: var(--shadow);

  border-radius: var(--radius-lg);
}

.panel {
  padding: 22px;
}

.panel-head,
.page-actions,
.button-row,
.field-row,
.row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2,
.panel h2 {
  margin: 5px 0 0;
}

.page-actions {
  margin-bottom: 20px;
}

.page-actions p {
  color: var(--muted);
}

/* =========================================================
   STATS
========================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 16px;

  margin-bottom: 22px;
}

.stat {
  position: relative;

  padding: 20px;

  overflow: hidden;

  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.stat::after {
  content: "";

  position: absolute;

  width: 90px;
  height: 90px;

  right: -34px;
  top: -34px;

  border-radius: 999px;

  background: radial-gradient(circle, rgba(17, 20, 24, 0.06), transparent 70%);
}

.stat:hover {
  transform: translateY(-2px);

  box-shadow: var(--shadow-lg);
}

.stat span {
  display: block;

  color: var(--muted);

  font-size: 11px;
  font-weight: 650;
}

.stat strong {
  display: block;

  margin-top: 10px;

  font-size: 34px;
  line-height: 1;

  letter-spacing: -0.04em;
}

/* =========================================================
   GRID
========================================================= */

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

  gap: 20px;
}

/* =========================================================
   ROWS
========================================================= */

.row-card {
  padding: 14px 0;

  border-bottom: 1px solid var(--line);
}

.row-card:last-child {
  border-bottom: 0;
}

.row-card strong,
.row-card span {
  display: block;
}

.row-card span {
  margin-top: 3px;

  color: var(--muted);

  font-size: 12px;
}

/* =========================================================
   STATUS / PILLS
========================================================= */

.status,
.pill,
.status-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  width: max-content;

  padding: 6px 9px;

  border: 1px solid transparent;
  border-radius: 999px;

  background: #f0f2f4;

  color: #58616b !important;

  font-size: 10px !important;
  font-weight: 850;

  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status.ready,
.status.generated,
.status.uploaded,
.status.completed,
.status-badge.status-ready,
.status-completed,
.status-uploaded {
  border-color: #caebd8;

  background: var(--success-bg);

  color: var(--success) !important;
}

.status.pending,
.status.rendering {
  border-color: #d9e5f0;

  background: #eef5fb;

  color: #42627c !important;
}

.status.failed,
.status.drive_failed {
  border-color: #f1caca;

  background: var(--danger-bg);

  color: var(--danger) !important;
}

.status.archived {
  border-color: #e3e6e9;

  background: #f3f4f6;

  color: #6b7280 !important;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
  min-height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 8px;

  padding: 10px 15px;

  border: 1px solid var(--line-strong);
  border-radius: 12px;

  background: #ffffff;

  color: var(--ink);

  font-size: 12px;
  font-weight: 800;

  cursor: pointer;

  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    border var(--transition),
    color var(--transition);
}

.btn:hover {
  transform: translateY(-1px);

  box-shadow: var(--shadow-sm);
}

.btn.primary {
  border-color: var(--accent);

  background: linear-gradient(145deg, var(--accent), var(--accent-soft));

  color: #ffffff;
}

.btn.primary:hover {
  box-shadow: 0 10px 28px rgba(17, 20, 24, 0.15);
}

.btn.danger {
  border-color: #efc9c9;

  background: #ffffff;

  color: var(--danger);
}

.btn.delete {
  border-color: #c82929;

  background: #c82929;

  color: #ffffff;
}

.btn.delete:hover {
  border-color: #a91f1f;

  background: #a91f1f;
}

.btn.ghost {
  background: var(--surface-soft);
}

.btn.small {
  min-height: 36px;

  padding: 8px 11px;

  font-size: 11px;
}

/* =========================================================
   TEMPLATE CARDS
========================================================= */

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

  gap: 18px;
}

.template-card {
  overflow: hidden;

  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.template-card:hover {
  transform: translateY(-3px);

  box-shadow: var(--shadow-lg);
}

.template-card img {
  display: block;

  width: 100%;

  aspect-ratio: 4 / 3;

  object-fit: cover;

  background: #eef1f3;
}

.template-info {
  padding: 16px;
}

.template-info h3 {
  margin: 9px 0 5px;

  font-size: 16px;
}

.template-info p {
  margin: 0;

  color: var(--muted);

  font-size: 11px;
}

/* =========================================================
   FORMS
========================================================= */

.form-card {
  display: grid;
  gap: 16px;
}

.form-card label {
  display: grid;
  gap: 8px;

  color: var(--ink-soft);

  font-size: 12px;
  font-weight: 750;
}

.form-card input,
.form-card textarea,
.form-card select {
  width: 100%;

  padding: 12px 13px;

  border: 1px solid var(--line-strong);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.94);

  color: var(--ink);

  outline: none;

  transition:
    border var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.form-card input:focus,
.form-card textarea:focus,
.form-card select:focus {
  border-color: #aeb5bd;

  background: #ffffff;

  box-shadow: 0 0 0 4px rgba(17, 20, 24, 0.05);
}

.form-card textarea {
  min-height: 110px;

  resize: vertical;
}

.form-card small {
  color: var(--muted);

  font-weight: 500;
}

/* =========================================================
   GUIDE
========================================================= */

.guide ol {
  padding-left: 20px;

  color: #4f5963;

  line-height: 1.9;
}

/* =========================================================
   PREVIEW
========================================================= */

.preview-large img {
  display: block;

  width: 100%;

  max-height: 74vh;

  object-fit: contain;

  border-radius: 14px;

  background: linear-gradient(180deg, #f6f7f8, #eef1f3);
}

.sticky {
  position: sticky;
  top: 24px;
}

/* =========================================================
   FIELD LIST
========================================================= */

.field-list {
  margin-top: 14px;
}

.field-row {
  padding: 12px 0;

  border-bottom: 1px solid var(--line);
}

.field-row:last-child {
  border-bottom: 0;
}

.field-row strong,
.field-row span {
  display: block;
}

.field-row span {
  color: var(--muted);

  font-size: 11px;
}

/* =========================================================
   FLASH MESSAGES
========================================================= */

.flash-stack {
  display: grid;
  gap: 10px;

  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;

  border: 1px solid #d5e5f2;
  border-radius: 12px;

  background: var(--info-bg);

  color: var(--info);

  font-size: 12px;
  font-weight: 650;
}

.flash.success {
  border-color: #caebd8;

  background: var(--success-bg);

  color: var(--success);
}

.flash.warning {
  border-color: #f1dfa8;

  background: var(--warning-bg);

  color: var(--warning);
}

.flash.danger {
  border-color: #f0cccc;

  background: var(--danger-bg);

  color: var(--danger) !important;
}

/* =========================================================
   AUTH
========================================================= */

.auth-card {
  display: grid;
  grid-template-columns:
    1.2fr
    0.8fr;

  overflow: hidden;

  margin-top: 40px;
}

.auth-copy {
  padding: 52px;

  background:
    radial-gradient(
      circle at 20% 0%,
      rgba(255, 255, 255, 0.08),
      transparent 30%
    ),
    linear-gradient(145deg, #101317, #1f252c);

  color: #ffffff;
}

.auth-copy h2 {
  max-width: 520px;

  margin: 0;

  font-size: 42px;

  letter-spacing: -0.04em;
}

.auth-copy p {
  color: #bec4ca;

  line-height: 1.7;
}

.auth-card .form-card {
  padding: 44px;

  align-content: center;
}

/* =========================================================
   TABLES
========================================================= */

table {
  width: 100%;

  border-collapse: collapse;

  overflow: hidden;
}

th,
td {
  padding: 13px 12px;

  border-bottom: 1px solid var(--line);

  text-align: left;

  font-size: 12px;
}

th {
  color: var(--muted);

  font-size: 10px;
  font-weight: 850;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: rgba(247, 249, 251, 0.9);
}

/* =========================================================
   CODE
========================================================= */

pre {
  padding: 14px;

  overflow: auto;

  white-space: pre-wrap;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: #f7f9fa;

  color: #303840;
}

/* =========================================================
   EMPTY STATES
========================================================= */

.empty {
  padding: 30px;

  border: 1px dashed var(--line-strong);
  border-radius: 14px;

  background: rgba(248, 250, 252, 0.7);

  color: var(--muted);

  text-align: center;
}

.empty.wide {
  grid-column: 1 / -1;
}

/* =========================================================
   RESULT
========================================================= */

.result-panel {
  align-self: start;
}

.result-panel .btn {
  margin-right: 8px;
  margin-top: 12px;
}

/* =========================================================
   SCROLLBAR
========================================================= */

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

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

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;

  background: rgba(110, 120, 130, 0.28);

  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 120, 130, 0.42);

  background-clip: padding-box;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 250px;
  }

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

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

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

  .sticky {
    position: static;
  }
}

@media (max-width: 800px) {
  .mobile-header {
    position: sticky;
    top: 0;

    z-index: 90;

    height: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 16px;

    border-bottom: 1px solid var(--line);

    background: rgba(255, 255, 255, 0.9);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-brand strong {
    font-size: 14px;
  }

  .mobile-menu-button {
    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border: 1px solid var(--line);
    border-radius: 11px;

    background: #ffffff;

    color: var(--ink);

    font-size: 18px;

    cursor: pointer;
  }

  .sidebar {
    left: 0;

    width: 280px;

    transform: translateX(-105%);

    transition: transform 0.24s ease;

    box-shadow: 24px 0 70px rgba(15, 23, 42, 0.18);
  }

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

  .sidebar-overlay {
    position: fixed;
    inset: 0;

    display: block;

    z-index: 95;

    pointer-events: none;

    background: rgba(17, 20, 24, 0);

    backdrop-filter: blur(0);

    transition:
      background 0.2s ease,
      backdrop-filter 0.2s ease;
  }

  .sidebar-overlay.visible {
    pointer-events: auto;

    background: rgba(17, 20, 24, 0.32);

    backdrop-filter: blur(2px);
  }

  .shell {
    width: 100%;

    margin-left: 0;

    padding: 24px 18px 50px;
  }

  .topbar {
    flex-direction: column;

    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .clock-card {
    flex: 1;

    text-align: left;
  }

  .profile-chip {
    flex: 1;
  }

  .page-actions {
    align-items: flex-start;

    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .stats-grid,
  .template-grid,
  .auth-card {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 20px 14px 44px;
  }

  .topbar h1 {
    font-size: 31px;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .clock-card,
  .profile-chip {
    width: 100%;
  }

  .panel {
    padding: 17px;

    border-radius: 18px;
  }

  .button-row {
    align-items: stretch;

    flex-direction: column;
  }

  .button-row .btn,
  .button-row form,
  .button-row form .btn {
    width: 100%;
  }

  .auth-copy {
    padding: 30px 24px;
  }

  .auth-copy h2 {
    font-size: 31px;
  }

  .auth-card .form-card {
    padding: 28px 22px;
  }
}
.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.mobile-menu-button svg {
  width: 22px;
  height: 22px;
  display: block;
}
.automation-step {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.automation-step-content {
  min-width: 0;
  width: 100%;
}

.automation-step-content h4 {
  margin: 0 0 6px;
  line-height: 1.3;
}

.automation-step-content p {
  margin: 0;

  width: 100%;
  max-width: none;

  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;

  line-height: 1.55;
}
