
  :root {
    color-scheme: light;
    /* Mantine v7-inspired palette */
    --es-blue: #228be6;          /* blue.6 — primary */
    --es-blue-hover: #1c7ed6;    /* blue.7 */
    --es-blue-active: #1971c2;   /* blue.8 */
    --es-blue-light: #e7f5ff;    /* blue.0 */
    --es-blue-light-2: #d0ebff;  /* blue.1 */
    --es-blue-border: #74c0fc;   /* blue.4 */
    --es-blue-text: #1971c2;     /* blue.8 */
    --es-indigo: #4263eb;        /* indigo.6 */
    --es-cyan: #15aabf;          /* cyan.6 */
    --es-red: #fa5252;           /* red.6 */
    --es-red-hover: #f03e3e;     /* red.7 */
    --es-red-light: #fff5f5;     /* red.0 */
    --es-red-border: #ffc9c9;    /* red.2 */
    --es-red-text: #c92a2a;      /* red.9 */
    --es-green: #40c057;         /* green.6 */
    --es-green-light: #ebfbee;   /* green.0 */
    --es-green-border: #b2f2bb;  /* green.2 */
    --es-green-text: #2b8a3e;    /* green.8 */
    --es-yellow-light: #fff9db;  /* yellow.0 */
    --es-yellow-border: #ffec99; /* yellow.2 */
    --es-yellow-text: #e67700;   /* yellow.9 */
    --es-orange-text: #d9480f;   /* orange.9 */
    --es-violet-light: #f3f0ff;  /* violet.0 */
    --es-violet-text: #5f3dc4;   /* violet.9 */
    --es-ink: #212529;           /* gray.9 */
    --es-text: #343a40;          /* gray.8 */
    --es-text-soft: #495057;     /* gray.7 */
    --es-muted: #868e96;         /* gray.6 */
    --es-muted-2: #adb5bd;       /* gray.5 */
    --es-line: #dee2e6;          /* gray.3 */
    --es-line-soft: #e9ecef;     /* gray.2 */
    --es-bg-sub: #f8f9fa;        /* gray.0 */
    --es-bg-sub-2: #f1f3f5;      /* gray.1 */
    --es-card: #ffffff;
    --es-radius-xs: 2px;
    --es-radius-sm: 4px;
    --es-radius-md: 8px;
    --es-radius-lg: 12px;
    --es-shadow-xs: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.1);
    --es-shadow-sm: 0 1px 3px rgba(0,0,0,.05), rgba(0,0,0,.05) 0 10px 15px -5px, rgba(0,0,0,.04) 0 7px 7px -5px;
    --es-shadow-md: 0 1px 3px rgba(0,0,0,.05), rgba(0,0,0,.05) 0 20px 25px -5px, rgba(0,0,0,.04) 0 10px 10px -5px;
    --es-shadow-lg: 0 1px 3px rgba(0,0,0,.05), rgba(0,0,0,.05) 0 28px 23px -7px, rgba(0,0,0,.04) 0 12px 12px -7px;
  }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans KR", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--es-text);
  }
  .page-shell { min-height: 100vh; background: var(--es-bg-sub); color: var(--es-text); }
  .topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--es-line-soft);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; position: sticky; top: 0; z-index: 20;
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--es-ink); letter-spacing: -0.01em; }
  .brand-mark {
    width: 32px; height: 32px; border-radius: var(--es-radius-sm);
    display: grid; place-items: center; color: #fff;
    background: var(--es-blue);
    font-weight: 700;
  }
  .btn {
    border: 1px solid var(--es-line);
    background: #fff;
    color: var(--es-text);
    padding: 8px 14px;
    height: 36px;
    border-radius: var(--es-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
  }
  .btn:hover { background: var(--es-bg-sub); border-color: var(--es-muted-2); }
  .btn.primary { background: var(--es-blue); border-color: var(--es-blue); color: #fff; }
  .btn.primary:hover { background: var(--es-blue-hover); border-color: var(--es-blue-hover); }
  .btn.danger { background: var(--es-red); border-color: var(--es-red); color: #fff; }
  .btn.danger:hover { background: var(--es-red-hover); border-color: var(--es-red-hover); }
  .btn.icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; }
  .input, .select, .textarea {
    width: 100%;
    border: 1px solid var(--es-line);
    border-radius: var(--es-radius-sm);
    padding: 8px 12px;
    height: 36px;
    background: #fff;
    color: var(--es-text);
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color .12s ease;
  }
  .input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--es-blue);
  }
  .textarea { min-height: 86px; height: auto; resize: vertical; }
  .label { display: block; font-size: 14px; font-weight: 500; color: var(--es-text); margin-bottom: 6px; }
  .layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 60px); transition: grid-template-columns 0.22s ease; }
  .layout.layout--nav-collapsed { grid-template-columns: 52px 1fr; }
  .layout.layout--nav-collapsed .sidebar { padding: 0; border-right: 1px solid var(--es-line-soft); overflow: visible; min-width: 52px; }
  .layout.layout--nav-collapsed .sidebar__inner { display: none !important; }
  .sidebar { border-right: 1px solid var(--es-line-soft); background: #fff; padding: 0; position: relative; display: flex; flex-direction: column; }
  .sidebar__toggle {
    position: absolute; right: -14px; top: 20px; z-index: 6;
    width: 28px; height: 28px; border-radius: 999px; border: 1px solid var(--es-line);
    background: #fff; box-shadow: var(--es-shadow-xs); cursor: pointer;
    display: grid; place-items: center; font-size: 13px; color: var(--es-text-soft);
  }
  .layout.layout--nav-collapsed .sidebar__toggle {
    left: 50%; right: auto; top: 14px; transform: translateX(-50%);
  }
  .layout:not(.layout--nav-collapsed) .sidebar__toggle { transform: none; }
  .sidebar__toggle:hover { border-color: var(--es-blue-border); color: var(--es-blue); }
  .sidebar__inner { padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 4px; transition: opacity 0.18s ease, transform 0.18s ease; flex: 1; min-height: 0; overflow-y: auto; }
  .main { padding: 24px; background: var(--es-bg-sub); }
  .dash-hero {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-md);
    padding: 24px 26px;
    margin-bottom: 18px;
  }
  .dash-hero__cta { margin-top: 14px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; position: relative; z-index: 2; pointer-events: auto; }
  #dashOpenUploadBtn { position: relative; z-index: 3; touch-action: manipulation; }
  .eyebrow { margin-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--es-blue); letter-spacing: .04em; text-transform: uppercase; }
  .dash-hero h1 { margin: 0; font-size: clamp(24px, 2.6vw, 32px); font-weight: 700; color: var(--es-ink); letter-spacing: -0.02em; line-height: 1.2; }
  .dash-hero p { margin: 10px 0 0; font-size: 14px; color: var(--es-text-soft); line-height: 1.65; max-width: 760px; }
  .dash-quick-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
  .dash-quick-steps span {
    display: inline-flex; align-items: center; min-height: 28px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--es-blue-light); color: var(--es-blue-text);
    border: 1px solid var(--es-blue-light-2);
    font-size: 12px; font-weight: 600;
  }
  .dash-hero__cta .btn-ms-accent { flex-shrink: 0; }
  .btn-ms-accent { background: #fd7e14; border: 1px solid #fd7e14; color: #fff; }
  .btn-ms-accent:hover { background: #f76707; border-color: #f76707; }
  .recent-table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .recent-table th { text-align: left; padding: 10px 12px; color: var(--es-muted); font-size: 12px; font-weight: 600; text-transform: none; border-bottom: 1px solid var(--es-line-soft); background: var(--es-bg-sub); }
  .recent-table td { padding: 12px; border-bottom: 1px solid var(--es-line-soft); vertical-align: middle; }
  .recent-table tr:hover td { background: var(--es-bg-sub); }
  .recent-table .recent-actions { text-align: right; white-space: nowrap; }
  .recent-table .recent-actions .btn { margin-left: 6px; }
  /* Dashboard recent-docs panel: allow the kebab dropdown to extend below the
     panel/section without being clipped by overflow:hidden, and reserve some
     bottom space inside the dashboard view so the dropdown always has room. */
  #dashboardView .panel { overflow: visible; }
  #dashboardView { padding-bottom: 200px; }
  .detail-flow { display: none; flex-shrink: 0; padding: 12px 18px; background: #1e293b; color: #e2e8f0; border-bottom: 1px solid #334155; }
  .detail-flow.is-visible { display: block; }
  .detail-flow__steps { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
  .detail-flow__step {
    padding: 6px 14px; border-radius: 999px; color: #94a3b8; cursor: pointer; border: 1px solid transparent;
    background: transparent; font: inherit; font-weight: 600;
  }
  .detail-flow__step.is-active { background: #fff; color: var(--es-ink); border-color: var(--es-line); }
  .detail-flow__step.is-done { color: #cbd5e1; }
  .detail-flow__nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
  .sign-wizard-host { display: none; flex: 1; min-height: 0; overflow: auto; padding: 24px 20px 32px; background: var(--es-bg-sub); }
  .sign-wizard-host.is-visible { display: flex; flex-direction: column; align-items: center; }
  .sign-wizard-card { width: min(560px, 100%); background: #fff; border-radius: var(--es-radius-md); border: 1px solid var(--es-line-soft); padding: 22px 22px 18px; box-shadow: var(--es-shadow-xs); }
  .sign-order-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
  .sign-order-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--es-line); border-radius: var(--es-radius-sm); cursor: pointer; background: #fff; }
  .sign-order-option.on { border-color: var(--es-blue); background: var(--es-blue-light); }
  .sign-order-option input { margin-top: 3px; }
  .sign-order-option small { display: block; color: var(--es-muted); font-weight: 500; margin-top: 4px; font-size: 12px; line-height: 1.45; }
  .signer-draft-card { border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 14px; margin-bottom: 12px; background: #fff; }
  .signer-draft-card__head { font-size: 12px; font-weight: 700; color: var(--es-muted); margin-bottom: 10px; }
  .signer-add-slot { width: 100%; border: 1px dashed var(--es-line); border-radius: var(--es-radius-md); padding: 18px; text-align: center; color: var(--es-muted); font-weight: 600; font-size: 14px; cursor: pointer; background: var(--es-bg-sub); }
  .signer-add-slot:hover { border-color: var(--es-blue-border); background: var(--es-blue-light); color: var(--es-blue-text); }
  .detail-tools-signer-nav { display: none; flex-direction: column; gap: 8px; }
  .detail-tools-signer-nav.is-visible { display: flex; }
  .signer-nav-acc { border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-sm); overflow: hidden; background: #fff; }
  .signer-nav-acc__btn { width: 100%; text-align: left; padding: 10px 12px; border: 0; background: var(--es-yellow-light); font-weight: 600; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; color: var(--es-yellow-text); }
  .signer-nav-acc__btn.is-open { background: var(--es-yellow-border); }
  .signer-nav-acc__btn:nth-of-type(4n+2) { background: var(--es-green-light); color: var(--es-green-text); }
  .signer-nav-acc__btn:nth-of-type(4n+3) { background: var(--es-violet-light); color: var(--es-violet-text); }
  .signer-nav-acc__btn:nth-of-type(4n) { background: #fff4e6; color: var(--es-orange-text); }
  .signer-nav-acc__body { display: none; padding: 10px; border-top: 1px solid var(--es-line-soft); background: var(--es-bg-sub); }
  .signer-nav-acc.is-open .signer-nav-acc__body { display: block; }
  .signer-toolbox-slots { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
  .signer-toolbox-acc { border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-sm); overflow: hidden; background: #fff; }
  .signer-toolbox-acc__btn {
    width: 100%;
    text-align: left;
    padding: 10px 10px;
    border: 0;
    background: var(--es-yellow-light);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--es-yellow-text);
  }
  .signer-toolbox-acc__btn.is-open { background: var(--es-yellow-border); }
  .signer-toolbox-acc:nth-of-type(4n + 2) .signer-toolbox-acc__btn { background: var(--es-green-light); color: var(--es-green-text); }
  .signer-toolbox-acc:nth-of-type(4n + 3) .signer-toolbox-acc__btn { background: var(--es-violet-light); color: var(--es-violet-text); }
  .signer-toolbox-acc:nth-of-type(4n) .signer-toolbox-acc__btn { background: #fff4e6; color: var(--es-orange-text); }
  .signer-toolbox-acc__body { display: none; padding: 10px; border-top: 1px solid var(--es-line-soft); background: var(--es-bg-sub); }
  .signer-toolbox-acc.is-open .signer-toolbox-acc__body { display: block; }
  .signer-toolbox-row { display: flex; flex-direction: column; gap: 8px; }
  .signer-toolbox-row .select { width: 100%; font-size: 12px; }
  .detail-editor-workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .detail-editor-workspace.is-hidden { display: none !important; }
  .attachment-modal .dialog { width: min(480px, 100%); border-radius: var(--es-radius-md); }
  .attachment-block { border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-sm); padding: 14px; margin-bottom: 12px; background: var(--es-bg-sub); position: relative; }
  .attachment-block .btn--del { position: absolute; top: 10px; right: 10px; font-size: 12px; padding: 4px 8px; height: 28px; }
  .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .toggle-switch { position: relative; width: 44px; height: 24px; border-radius: 999px; background: var(--es-muted-2); cursor: pointer; border: 0; flex-shrink: 0; }
  .toggle-switch.is-on { background: var(--es-blue); }
  .toggle-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
  .toggle-switch.is-on::after { transform: translateX(20px); }
  .navbtn { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: var(--es-radius-sm); cursor: pointer; font-weight: 500; font-size: 14px; color: var(--es-text); }
  .navbtn:hover { background: var(--es-bg-sub); }
  .navbtn.active { background: var(--es-blue-light); color: var(--es-blue-text); font-weight: 600; }
  .toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .doc-ms-page { max-width: none; margin: 0; width: 100%; }
  .doc-ms-title { margin: 0 0 16px; font-size: 20px; font-weight: 700; color: var(--es-ink); }
  .doc-filter-card {
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-md);
    padding: 14px 16px;
    margin-bottom: 14px;
    overflow: hidden;
  }
  .doc-filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
  .doc-filter-row:last-child { margin-bottom: 0; }
  .doc-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 100%; }
  .doc-filter-field--grow { flex: 1 1 200px; }
  .doc-filter-field--sm { flex: 1 1 140px; }
  .doc-filter-field--md { flex: 1 1 180px; }
  .doc-filter-field label { font-size: 12px; font-weight: 500; color: var(--es-muted); }
  .doc-filter-field .input, .doc-filter-field .select { padding: 6px 10px; height: 32px; font-size: 13px; }
  .doc-filter-field input[type="date"] { width: 100%; max-width: 100%; box-sizing: border-box; }
  .doc-search-with-icon { position: relative; }
  .doc-search-with-icon .input { padding-right: 34px; }
  .doc-search-with-icon span {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    font-size: 14px; color: var(--es-muted-2); pointer-events: none;
  }
  .doc-table-panel { background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); overflow: hidden; }
  .doc-table-scroll { overflow-x: auto; min-height: 560px; }
  .doc-ms-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
  .doc-ms-table th {
    text-align: left;
    padding: 11px 12px;
    color: var(--es-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--es-line-soft);
    background: var(--es-bg-sub);
    white-space: nowrap;
  }
  .doc-ms-table td { padding: 12px; border-bottom: 1px solid var(--es-line-soft); vertical-align: middle; color: var(--es-text); }
  .doc-ms-table tbody tr:hover td { background: var(--es-bg-sub); }
  .doc-ms-table .doc-col-check { width: 40px; text-align: center; }
  .doc-ms-table .doc-col-status { width: 160px; }
  .doc-ms-table .doc-col-time { width: 100px; white-space: nowrap; }
  .doc-ms-table .doc-col-actions { width: 56px; text-align: right; }
  .doc-title-cell strong { display: block; font-size: 14px; font-weight: 600; color: var(--es-ink); line-height: 1.35; }
  .doc-title-cell .sub { margin-top: 4px; font-size: 12px; color: var(--es-muted); font-weight: 400; }
  .doc-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .doc-pill--ok { background: var(--es-green-light); color: var(--es-green-text); border: 1px solid var(--es-green-border); }
  .doc-pill--blue { background: var(--es-blue-light); color: var(--es-blue-text); border: 1px solid var(--es-blue-light-2); }
  .doc-pill--amber { background: var(--es-yellow-light); color: var(--es-yellow-text); border: 1px solid var(--es-yellow-border); }
  .doc-pill--muted { background: var(--es-bg-sub-2); color: var(--es-text-soft); border: 1px solid var(--es-line-soft); }
  .doc-pill--red { background: var(--es-red-light); color: var(--es-red-text); border: 1px solid var(--es-red-border); }
  .doc-row-menu-wrap { position: relative; display: inline-block; }
  .doc-kebab {
    width: 32px; height: 32px; border: 1px solid var(--es-line); border-radius: var(--es-radius-sm);
    background: #fff; cursor: pointer; font-size: 16px; line-height: 1; color: var(--es-text-soft);
    display: inline-grid; place-items: center; padding: 0;
  }
  .doc-kebab:hover { border-color: var(--es-muted-2); background: var(--es-bg-sub); }
  /* Flex column + explicit width forces vertical stacking and ignores any
     white-space:nowrap inherited from the surrounding table cell (which was
     previously laying the buttons out horizontally inside the recent-docs
     panel). */
  .doc-row-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    width: 180px;
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-sm);
    box-shadow: var(--es-shadow-md);
    z-index: 40;
    padding: 4px;
    text-align: left;
    white-space: normal;
  }
  .doc-row-menu.is-open { display: flex; }
  .doc-row-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 8px 10px;
    border-radius: var(--es-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--es-text);
    cursor: pointer;
    white-space: nowrap;
  }
  .doc-row-menu button:hover { background: var(--es-bg-sub); }
  .doc-row-menu button.danger { color: var(--es-red-text); }
  .doc-row-menu button.danger:hover { background: var(--es-red-light); }
  .doc-ms-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 14px;
    border-top: 1px solid var(--es-line-soft);
    background: var(--es-bg-sub);
  }
  .doc-ms-pager { display: flex; align-items: center; justify-content: center; gap: 4px; flex: 1; }
  .doc-ms-pager button {
    min-width: 32px; height: 32px; border: 1px solid var(--es-line); border-radius: var(--es-radius-sm);
    background: #fff; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--es-text);
  }
  .doc-ms-pager button:hover:not(:disabled) { background: var(--es-bg-sub); }
  .doc-ms-pager button:disabled { opacity: 0.45; cursor: not-allowed; }
  .doc-ms-pager .doc-ms-pager__cur {
    min-width: 32px; height: 32px; display: inline-grid; place-items: center;
    border-radius: var(--es-radius-sm); background: var(--es-blue); color: #fff; font-weight: 600; font-size: 13px;
  }
  @media (max-width: 980px) {
    .doc-filter-field--sm, .doc-filter-field--md { flex: 1 1 160px; }
  }
  .grid { display: grid; gap: 14px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat { background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 18px; color: var(--es-text-soft); font-size: 13px; font-weight: 500; }
  .stat strong { display: block; font-size: 28px; margin-top: 6px; color: var(--es-ink); letter-spacing: -0.02em; font-weight: 700; }
  .panel { background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); overflow: hidden; }
  .panel-head { padding: 14px 16px; border-bottom: 1px solid var(--es-line-soft); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
  .panel-body { padding: 16px; }
  .table { width: 100%; border-collapse: collapse; }
  .table th, .table td { padding: 12px; border-bottom: 1px solid var(--es-line-soft); text-align: left; font-size: 14px; vertical-align: middle; }
  .table th { color: var(--es-muted); font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 600; }
  .badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; }
  .badge.DRAFT { background: var(--es-bg-sub-2); color: var(--es-text-soft); }
  .badge.PENDING_APPROVAL { background: var(--es-yellow-light); color: var(--es-yellow-text); }
  .badge.APPROVED { background: var(--es-green-light); color: var(--es-green-text); }
  .badge.REJECTED { background: var(--es-red-light); color: var(--es-red-text); }
  .badge.IN_PROGRESS { background: var(--es-blue-light); color: var(--es-blue-text); }
  .badge.COMPLETED { background: var(--es-green-light); color: var(--es-green-text); }
  .badge.SENT { background: var(--es-blue-light); color: var(--es-blue-text); }
  .badge.PENDING { background: var(--es-yellow-light); color: var(--es-yellow-text); }
  .badge.VIEWED { background: var(--es-violet-light); color: var(--es-violet-text); }
  .badge.SIGNED { background: var(--es-green-light); color: var(--es-green-text); }
  .badge.DECLINED { background: var(--es-red-light); color: var(--es-red-text); }
  .hidden { display: none !important; }
  .modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 30; padding: 18px; }
  /* 업로드: #detailModal 과 동일 div.modal + .hidden; z-index 만 상향 */
  #uploadModal.modal { z-index: 100; }
  /* Fullpage detail surface: removes the centered-dialog padding/backdrop so
     the document workspace fills the whole viewport. */
  .modal.modal--fullpage { padding: 0; background: #fff; place-items: stretch; }
  .dialog { width: min(760px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: var(--es-radius-md); border: 1px solid var(--es-line-soft); box-shadow: var(--es-shadow-lg); }
  .dialog-head { padding: 18px 22px; border-bottom: 1px solid var(--es-line-soft); display: flex; align-items: center; justify-content: space-between; background: #fff; }
  .dialog-body { padding: 22px; }
  .form-grid { display: grid; gap: 14px; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
  .dialog--detail {
    width: min(1480px, 100%);
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    border-radius: var(--es-radius-md);
    box-shadow: var(--es-shadow-lg);
    overflow: hidden;
  }
  .dialog--detail.dialog--detail--fullpage {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: #fff;
  }
  .modal--fullpage .detail-body {
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
  }
  .dialog--detail .dialog-head {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--es-line-soft);
  }
  .dialog--detail .dialog-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }
  .detail-body {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr) 320px;
    gap: 0;
    align-items: stretch;
    align-content: stretch;
    height: min(82vh, calc(100vh - 100px));
    max-height: min(82vh, calc(100vh - 100px));
    min-height: 440px;
    overflow: hidden;
    background: var(--es-bg-sub-2);
  }
  .detail-body.detail-body--no-left { grid-template-columns: 0 minmax(0, 1fr) 320px; }
  .detail-body.detail-body--no-right { grid-template-columns: 272px minmax(0, 1fr) 0; }
  .detail-body.detail-body--no-left.detail-body--no-right { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .detail-body.detail-body--sign-wizard {
    grid-template-columns: 0 minmax(0, 1fr) 0 !important;
  }
  .detail-body > .detail-tools,
  .detail-body > .detail-main,
  .detail-body > .detail-rail {
    min-height: 0;
    max-height: 100%;
  }
  .detail-tools {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border-right: 1px solid var(--es-line-soft);
    overflow: hidden;
  }
  .detail-tools__scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .ms-doc-edit-head {
    font-size: 12px;
    font-weight: 600;
    color: var(--es-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 8px;
  }
  .ms-section {
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-sm);
    padding: 10px;
    background: #fff;
  }
  .ms-section__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--es-ink);
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .ms-section__title .ms-badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--es-yellow-light);
    color: var(--es-yellow-text);
    padding: 2px 7px;
    border-radius: var(--es-radius-xs);
  }
  .ms-hint {
    font-size: 12px;
    color: var(--es-muted);
    line-height: 1.5;
    margin: 0 0 8px;
  }
  .ms-tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .ms-tool-btn {
    border: 1px solid var(--es-line);
    background: #fff;
    border-radius: var(--es-radius-sm);
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--es-text);
    text-align: center;
  }
  .ms-tool-btn:hover { border-color: var(--es-blue-border); background: var(--es-blue-light); color: var(--es-blue-text); }
  .ms-tool-btn.active { border-color: var(--es-blue); background: var(--es-blue-light); color: var(--es-blue-text); }
  .ms-mini-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
  .ms-mini-row .input { padding: 6px 8px; font-size: 13px; height: 32px; }
  .ms-list { display: flex; flex-direction: column; gap: 6px; max-height: 140px; overflow-y: auto; }
  .ms-list-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: start;
    font-size: 12px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-sm);
  }
  .ms-list-item code { font-size: 11px; color: var(--es-blue-text); }
  .ms-list-item--selected {
    border-color: var(--es-blue);
    background: var(--es-blue-light);
    cursor: pointer;
  }
  .ms-list-item--clickable {
    cursor: pointer;
  }
  .detail-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--es-bg-sub-2);
    border-right: 1px solid var(--es-line-soft);
  }
  .detail-zoom-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--es-line-soft);
  }
  .detail-zoom-bar .btn.icon { width: 30px; height: 30px; font-size: 14px; }
  .detail-zoom-bar span { font-size: 12px; font-weight: 500; color: var(--es-text-soft); min-width: 44px; text-align: center; }
  .detail-canvas-scaler {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
  }
  .detail-canvas-scaler__inner {
    flex: 1 1 auto;
    min-height: 0;
    width: min(920px, 96vw);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    transform-origin: top center;
    transition: transform 0.12s ease;
  }
  .detail-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid var(--es-line-soft);
  }
  .detail-toolbar__chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .detail-chip {
    border: 1px solid var(--es-line);
    background: #fff;
    padding: 6px 12px;
    height: 32px;
    border-radius: var(--es-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--es-text);
    display: inline-flex;
    align-items: center;
  }
  .detail-chip:hover { border-color: var(--es-blue-border); background: var(--es-blue-light); color: var(--es-blue-text); }
  .detail-chip.active { border-color: var(--es-blue); background: var(--es-blue-light); color: var(--es-blue-text); }
  .detail-toolbar__grow { flex: 1; min-width: 8px; }
  .detail-canvas-wrap {
    flex: 1;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
  }
  .detail-main .detail-canvas-wrap {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    width: 100%;
  }
  .detail-main .builder-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    border-radius: var(--es-radius-sm);
    border: 1px solid var(--es-line-soft);
    background: var(--es-bg-sub-2);
    overflow: hidden;
  }
  .detail-main .file-frame {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    border: 0;
    display: block;
  }
  .detail-rail {
    display: block;
    min-width: 0;
    min-height: 0;
    background: var(--es-bg-sub);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
  }
  .detail-rail-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: min-content;
  }
  .detail-inspector {
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-md);
    overflow: hidden;
  }
  .detail-inspector__head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--es-line-soft);
    font-weight: 600;
    font-size: 14px;
    color: var(--es-ink);
  }
  .detail-inspector__body { padding: 14px; }
  .detail-inspector__empty {
    color: var(--es-muted);
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
  }
  .detail-inspector-form.hidden { display: none !important; }
  .detail-field-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--es-line-soft);
    font-size: 13px;
    color: var(--es-text-soft);
    max-height: 180px;
    overflow-y: auto;
  }
  .detail-field-list__hint { font-size: 12px; color: var(--es-muted-2); margin: 0 0 8px; }
  .detail-field-list__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-radius: var(--es-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
  }
  .detail-field-list__row:hover { background: var(--es-bg-sub); }
  .detail-field-list__row--selected { background: var(--es-blue-light); border-color: var(--es-blue-light-2); }
  .detail-field-empty {
    text-align: center;
    padding: 16px 12px;
    background: var(--es-bg-sub);
    border: 1px dashed var(--es-line);
    border-radius: var(--es-radius-sm);
    font-size: 13px;
    color: var(--es-muted);
    line-height: 1.5;
  }
  .detail-accordion__item {
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-md);
    overflow: hidden;
  }
  .detail-accordion__head {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 0;
    background: #fff;
    font-weight: 600;
    font-size: 14px;
    color: var(--es-ink);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .detail-accordion__head::after {
    content: "›";
    font-size: 18px;
    font-weight: 400;
    color: var(--es-muted-2);
    transition: transform 0.15s;
    transform: rotate(90deg);
  }
  .detail-accordion__item.is-open .detail-accordion__head::after { transform: rotate(-90deg); }
  .detail-accordion__body { display: none; padding: 0 14px 14px; }
  .detail-accordion__item.is-open .detail-accordion__body { display: block; }
  .detail-tools .detail-accordion__item.ms-tools-accordion {
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-sm);
  }
  .detail-tools .ms-tools-accordion .detail-accordion__head {
    font-size: 13px;
    padding: 10px 12px;
    background: #fff;
  }
  .detail-tools .ms-tools-accordion .detail-accordion__body {
    padding: 0 10px 12px;
    background: #fff;
  }
  .detail-rail .panel { margin: 0; border-radius: var(--es-radius-sm); border: 1px solid var(--es-line-soft); overflow: hidden; }
  .detail-rail .panel-head { padding: 10px 12px; font-size: 13px; }
  .detail-rail .panel-body { padding: 12px; }
  .detail-rail .small-row { grid-template-columns: 1fr; gap: 10px; }
  .detail-rail .small-row .btn { width: 100%; justify-self: stretch; }
  /* NOTE: grid 아이템을 display:none 하면 다음 아이템이 0px 컬럼으로 당겨져 iframe이 사라질 수 있어,
     숨김은 "폭 0 + 비가시"로 처리해 그리드 배치를 유지합니다. */
  .detail-tools.tools-hidden {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    border-right: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  .detail-rail.rail-hidden {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    border-left: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  .detail-body { position: relative; }
  .detail-side-toggle {
    position: absolute;
    top: 26px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--es-line);
    background: #fff;
    box-shadow: var(--es-shadow-xs);
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--es-text-soft);
    cursor: pointer;
    z-index: 25;
  }
  .detail-side-toggle:hover { border-color: var(--es-blue-border); color: var(--es-blue); }
  .detail-side-toggle--left { left: 252px; }
  .detail-side-toggle--right { right: 300px; }
  .detail-body.detail-body--no-left .detail-side-toggle--left { left: 8px; }
  .detail-body.detail-body--no-right .detail-side-toggle--right { right: 8px; }
  .detail-body.detail-body--sign-wizard .detail-side-toggle { display: none !important; }
  .detail-sign-savebar {
    display: none;
    border-top: 1px solid var(--es-line-soft);
    background: #fff;
    padding: 10px 14px;
    justify-content: flex-end;
  }
  .detail-sign-savebar.is-visible { display: flex; }
  .detail-sign-savebar .btn { min-width: 140px; }
  .detail-doc-actions { display: flex; flex-direction: column; gap: 8px; }
  .detail-stack-panels { display: flex; flex-direction: column; gap: 10px; }
  .file-frame { width: 100%; height: 72vh; border: 0; background: var(--es-bg-sub-2); }
  .notice { padding: 12px; border-radius: var(--es-radius-sm); background: var(--es-yellow-light); border: 1px solid var(--es-yellow-border); color: var(--es-yellow-text); }
  .toast { position: fixed; right: 18px; top: 18px; background: var(--es-ink); color: #fff; padding: 10px 14px; border-radius: var(--es-radius-sm); z-index: 60; max-width: 420px; font-size: 14px; box-shadow: var(--es-shadow-md); }
  .hero { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 28px; background: var(--es-bg-sub); }
  .auth-box { width: min(440px, 100%); background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 24px; box-shadow: var(--es-shadow-xs); }
  .home-shell { position: relative; min-height: calc(100vh - 60px); padding: 64px 26px 72px; background: var(--es-bg-sub); overflow: hidden; }
  .home-hero { position: relative; max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.8fr); gap: 38px; align-items: center; }
  .home-hero h1 { margin: 0; font-size: clamp(36px, 5vw, 56px); font-weight: 700; letter-spacing: -0.03em; color: var(--es-ink); line-height: 1.1; }
  .home-hero p { margin: 18px 0 0; font-size: 16px; color: var(--es-text-soft); line-height: 1.7; max-width: 54ch; }
  .home-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
  .home-trust-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
  .home-trust-strip span { padding: 5px 11px; border-radius: 999px; background: var(--es-green-light); color: var(--es-green-text); border: 1px solid var(--es-green-border); font-size: 12px; font-weight: 600; }
  .home-preview-card { position: relative; background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 22px; box-shadow: var(--es-shadow-sm); }
  .home-preview-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
  .home-preview-card__head strong { font-size: 15px; color: var(--es-ink); font-weight: 600; }
  .home-preview-card__head span { padding: 3px 9px; border-radius: 999px; background: var(--es-yellow-light); color: var(--es-yellow-text); border: 1px solid var(--es-yellow-border); font-size: 12px; font-weight: 600; }
  .home-flow-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
  .home-flow-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--es-radius-sm); background: var(--es-bg-sub); color: var(--es-text-soft); font-size: 13px; font-weight: 500; }
  .home-flow-list li span { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--es-line); color: var(--es-text-soft); font-size: 12px; font-weight: 600; }
  .home-flow-list li.is-done { background: var(--es-green-light); color: var(--es-green-text); }
  .home-flow-list li.is-done span { background: var(--es-green); color: #fff; }
  .home-flow-list li.is-active { background: var(--es-blue-light); color: var(--es-blue-text); }
  .home-flow-list li.is-active span { background: var(--es-blue); color: #fff; }
  .home-preview-card p { margin: 16px 0 0; font-size: 13px; color: var(--es-text-soft); line-height: 1.6; }
  .home-section { max-width: 1120px; margin: 34px auto 0; }
  .home-section h2 { margin: 0 0 12px; font-size: 18px; font-weight: 700; color: var(--es-ink); }
  .home-feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .home-feature { background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 16px; }
  .home-feature strong { display: block; font-size: 14px; font-weight: 600; color: var(--es-ink); }
  .home-feature p { margin: 8px 0 0; font-size: 13px; color: var(--es-text-soft); line-height: 1.6; }
  @media (max-width: 980px) {
    .home-hero { grid-template-columns: 1fr; }
    .home-feature-grid { grid-template-columns: 1fr; }
    .home-hero h1 { font-size: 32px; }
  }
  .viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; padding: 18px; }
  .canvas { width: 100%; height: 180px; border: 1px solid var(--es-line); border-radius: var(--es-radius-sm); background: #fff; touch-action: none; }
  .segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; background: var(--es-bg-sub-2); padding: 4px; border-radius: var(--es-radius-sm); }
  .segment { border: 0; border-radius: var(--es-radius-sm); padding: 7px 6px; font-weight: 500; font-size: 13px; cursor: pointer; background: transparent; color: var(--es-text-soft); }
  .segment.active { background: #fff; color: var(--es-blue-text); box-shadow: var(--es-shadow-xs); font-weight: 600; }
  .builder-wrap { position: relative; min-height: 360px; background: var(--es-bg-sub-2); overflow: hidden; }
  .builder-wrap .file-frame { pointer-events: auto; }
  .field-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }
  .field-box {
    position: absolute;
    border: 2px solid var(--es-blue);
    background: rgba(34, 139, 230, 0.12);
    color: var(--es-ink);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 6px;
    cursor: grab;
    overflow: hidden;
    line-height: 1.25;
    box-sizing: border-box;
    pointer-events: auto;
  }
  .field-box.field-box--selected {
    box-shadow: 0 0 0 3px rgba(34, 139, 230, 0.35);
    z-index: 3;
  }
  .field-box:active { cursor: grabbing; }
  .field-box__label { font-weight: 600; font-size: 11px; }
  .field-box__meta { font-size: 10px; font-weight: 500; color: var(--es-text-soft); margin-top: 2px; }
  .field-box__resize {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--es-blue-active);
    background: #ffffff;
    box-shadow: var(--es-shadow-xs);
    cursor: nwse-resize;
    pointer-events: auto;
  }
  .field-box__resize::before {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--es-blue-active);
    border-bottom: 2px solid var(--es-blue-active);
    box-sizing: border-box;
  }
  .small-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
  .stack { display: grid; gap: 10px; }
  .item-card { border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-sm); padding: 12px; background: #fff; }
  .item-title { font-weight: 600; color: var(--es-ink); }
  .item-sub { color: var(--es-muted); font-size: 13px; margin-top: 4px; }
  .item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
  .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--es-text-soft); word-break: break-all; }
  .dialog--upload { width: min(920px, 100%); }
  .upload-dropzone {
    position: relative;
    border: 1px dashed var(--es-muted-2);
    border-radius: var(--es-radius-md);
    background: var(--es-bg-sub);
    padding: 36px 24px 28px;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
  }
  .upload-dropzone--drag { border-color: var(--es-blue); background: var(--es-blue-light); }
  .upload-dropzone__text { margin: 0 0 16px; font-size: 14px; color: var(--es-text-soft); line-height: 1.5; }
  .upload-add-wrap { position: relative; display: inline-block; }
  .upload-add-btn {
    border: 1px solid var(--es-blue);
    background: #fff;
    color: var(--es-blue-text);
    padding: 8px 18px;
    height: 36px;
    border-radius: var(--es-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
  }
  .upload-add-btn:hover { background: var(--es-blue-light); }
  .upload-source-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(100% + 8px);
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-sm);
    box-shadow: var(--es-shadow-md);
    z-index: 5;
    padding: 4px;
    text-align: left;
  }
  .upload-source-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 8px 12px;
    border-radius: var(--es-radius-sm);
    font-weight: 500;
    font-size: 14px;
    color: var(--es-text);
    cursor: pointer;
    text-align: left;
  }
  .upload-source-menu button:hover { background: var(--es-bg-sub); }
  .upload-hint { margin: 12px 0 0; font-size: 12px; color: var(--es-muted); text-align: center; line-height: 1.5; }
  .upload-next-steps { border: 1px solid var(--es-blue-light-2); background: var(--es-blue-light); border-radius: var(--es-radius-md); padding: 14px 16px; color: var(--es-blue-active); }
  .upload-next-steps strong { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
  .upload-next-steps ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12px; line-height: 1.5; }
  .empty-state { display: grid; place-items: center; text-align: center; gap: 8px; padding: 30px 18px; color: var(--es-muted); background: transparent; }
  .empty-state::before { content: '✦'; width: 40px; height: 40px; border-radius: var(--es-radius-md); display: grid; place-items: center; background: var(--es-blue-light); color: var(--es-blue); font-size: 18px; }
  .empty-state strong { color: var(--es-ink); font-size: 15px; font-weight: 600; }
  .empty-state p { margin: 0; max-width: 42ch; font-size: 13px; line-height: 1.55; }
  .empty-state .btn { margin-top: 4px; }
  .empty-state--table { min-height: 126px; }
  .upload-file-row {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .upload-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--es-bg-sub-2);
    border-radius: var(--es-radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--es-text);
    max-width: 100%;
  }
  .upload-file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
  .upload-template-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--es-line-soft); }
  .upload-template-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
  .upload-template-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--es-ink); }
  .upload-template-info {
    width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--es-line);
    font-size: 11px; font-weight: 600; color: var(--es-muted); display: grid; place-items: center; cursor: default; flex-shrink: 0; margin-top: 2px;
  }
  .upload-template-desc { margin: 0 0 16px; font-size: 13px; color: var(--es-text-soft); line-height: 1.5; }
  .upload-template-label { font-size: 12px; font-weight: 600; color: var(--es-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
  .upload-template-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .upload-template-card {
    flex: 0 0 132px;
    scroll-snap-align: start;
    border: 1px solid var(--es-line-soft);
    border-radius: var(--es-radius-md);
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    text-align: left;
    padding: 0;
    transition: box-shadow 0.15s, border-color 0.15s;
  }
  .upload-template-card:hover { border-color: var(--es-blue-border); box-shadow: var(--es-shadow-xs); }
  .upload-template-card:focus { outline: 2px solid var(--es-blue); outline-offset: 2px; }
  .upload-template-card__thumb {
    height: 96px;
    background: var(--es-bg-sub-2);
    display: grid; place-items: center;
    font-size: 28px;
    color: var(--es-muted-2);
  }
  .upload-template-card__body { padding: 10px 10px 12px; }
  .upload-template-card__title { font-size: 13px; font-weight: 600; color: var(--es-ink); line-height: 1.3; }
  .upload-template-card__tag {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--es-radius-xs);
  }
  .upload-template-card__tag--sign { background: var(--es-blue-light); color: var(--es-blue-text); }
  .upload-template-card__tag--view { background: var(--es-bg-sub-2); color: var(--es-text-soft); }
  .upload-template-highlight { animation: upload-template-pulse 1.2s ease; }
  @keyframes upload-template-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,139,230,.35); }
    100% { box-shadow: 0 0 0 12px rgba(34,139,230,0); }
  }
  .btn--ghost { background: transparent; border: 0; color: var(--es-text-soft); font-weight: 500; cursor: pointer; padding: 6px 10px; border-radius: var(--es-radius-sm); height: 32px; }
  .btn--ghost:hover { background: var(--es-bg-sub); color: var(--es-ink); }
  .w-full { width: 100%; }
  .template-hero { background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 20px 22px; margin-bottom: 18px; }
  .template-hero h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; color: var(--es-ink); }
  .template-hero p { margin: 0; font-size: 14px; color: var(--es-text-soft); line-height: 1.6; }
  .template-hero a { color: var(--es-blue); font-weight: 500; }
  .template-fav-wrap { margin-bottom: 20px; }
  .template-fav-wrap h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--es-text); }
  .template-fav-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
  .template-fav-card {
    flex: 0 0 200px; background: #fff; border: 1px solid var(--es-line-soft); border-radius: var(--es-radius-md); padding: 14px;
    display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start;
  }
  .template-fav-card strong { font-size: 14px; color: var(--es-ink); font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .template-fav-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
  .template-register-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
  .template-register-row .grow { flex: 1; min-width: 220px; }
  .template-table-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  @media (max-width: 900px) {
    .layout, .split, .viewer-layout { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--es-line-soft); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-body {
      grid-template-columns: 1fr;
      height: auto;
      max-height: none;
      min-height: 0;
      overflow: visible;
    }
    .detail-body > .detail-main,
    .detail-body > .detail-rail {
      max-height: none;
    }
    .detail-main .builder-wrap {
      flex: none;
      height: 52vh;
      min-height: 280px;
      max-height: 52vh;
    }
    .detail-rail { max-height: 60vh; overflow-y: auto; }
  }
