:root{
  --ds-bg:#f1f5f9;
  --ds-surface:#ffffff;
  --ds-surface-2:#f5f8ff;
  --ds-surface-3:#eef2f9;
  --ds-ink:#0f172a;
  --ds-ink-2:#475569;
  --ds-ink-3:#94a3b8;
  --ds-border:#e2e8f0;
  --ds-border-2:#cbd5e1;
  --ds-blue:#1d4ed8;
  --ds-blue-dark:#1e3a8a;
  --ds-blue-light:#eff6ff;
  --ds-blue-mid:#3b82f6;
  --ds-green:#15803d;
  --ds-green-bg:#dcfce7;
  --ds-amber:#b45309;
  --ds-amber-bg:#fef3c7;
  --ds-red:#dc2626;
  --ds-red-bg:#fee2e2;
  --ds-purple:#6d28d9;
  --ds-purple-bg:#ede9fe;
}

#docustamp-root, #docustamp-root *{box-sizing:border-box}
#docustamp-root{font-family:'Lato',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:var(--ds-ink)}

.docustamp-shell{
  background:var(--ds-bg);
  border:1px solid var(--ds-border);
  border-radius:18px;
  overflow:hidden;
}

.ds-topbar{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:0 20px;
  background:var(--ds-surface);
  border-bottom:1px solid var(--ds-border-2);
  border-top:3px solid var(--ds-blue);
  box-shadow:0 1px 3px rgba(29,78,216,.06);
}
.ds-brand{display:flex;align-items:center;gap:12px;min-width:0}
.ds-brand-logo{
  max-height:40px;max-width:160px;object-fit:contain;
  background:var(--ds-surface);border:1px solid var(--ds-border);border-radius:10px;padding:6px
}
.ds-title{font-size:20px;font-weight:900;letter-spacing:-.3px;color:var(--ds-blue)}
.ds-subtitle{font-size:12px;color:var(--ds-ink-2);margin-top:1px}
.ds-userbox{
  display:flex;align-items:center;gap:10px;min-width:220px;
  padding:5px 12px;background:var(--ds-surface-2);border:1px solid var(--ds-border);border-radius:20px
}
.ds-avatar{
  width:24px;height:24px;border-radius:50%;background:var(--ds-blue);color:#fff;
  display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;flex-shrink:0
}
.ds-user{font-size:13px;font-weight:700;line-height:1.15}
.ds-role{font-size:12px;color:var(--ds-ink-2)}

.ds-tabs{
  display:flex;gap:2px;flex-wrap:wrap;
  padding:12px 20px;background:var(--ds-surface);border-bottom:1px solid var(--ds-border)
}
.ds-tab{
  background:transparent;border:0;padding:6px 12px;border-radius:6px;
  color:var(--ds-ink-2);font-size:13px;font-weight:600;cursor:pointer;
  transition:all .12s ease;font-family:inherit
}
.ds-tab:hover{background:var(--ds-blue-light);color:var(--ds-blue)}
.ds-tab.active{background:var(--ds-blue);color:#fff}

.ds-panel{display:none;padding:28px 20px;max-width:1360px;margin:0 auto}
.ds-panel.active{display:block}

.ds-grid{display:grid;gap:16px}
.ds-grid-2{grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr)}
.ds-grid-4,.ds-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}

.ds-card{
  background:var(--ds-surface);border:1px solid var(--ds-border);border-radius:12px;
  padding:18px;box-shadow:none
}
.ds-card h3,.ds-generated-files h4{margin:0 0 14px;font-size:15px;font-weight:700;letter-spacing:-.1px}
.ds-note{font-size:12px;color:var(--ds-ink-2);margin-top:12px;line-height:1.6}
.ds-note-alert{border:1px solid var(--ds-amber);background:#fff8db;color:#7c5a00;border-radius:10px;padding:12px 14px}

.ds-row-between{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;flex-wrap:wrap}
.ds-inline-actions,.ds-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}

.ds-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.ds-form-grid label,.ds-card label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:600;color:var(--ds-ink-2)}
.ds-span-2{grid-column:span 2}
.ds-form-grid input,.ds-form-grid textarea,.ds-form-grid select,.ds-card input,.ds-card select,.ds-card textarea,.ds-filters input,.ds-filters select{
  width:100%;padding:8px 11px;border:1px solid var(--ds-border-2);border-radius:6px;background:var(--ds-surface);color:var(--ds-ink);
  font-family:inherit;font-size:13px
}
.ds-form-grid input:focus,.ds-form-grid textarea:focus,.ds-form-grid select:focus,.ds-card input:focus,.ds-card select:focus,.ds-card textarea:focus,.ds-filters input:focus,.ds-filters select:focus{
  outline:none;border-color:var(--ds-blue);box-shadow:0 0 0 3px rgba(59,130,246,.12)
}

.ds-check-wrap{justify-content:flex-end}
.ds-check-wrap>.ds-check{
  display:flex;align-items:center;gap:8px;font-weight:600;font-size:13px;padding:10px 12px;
  border:1px solid var(--ds-border);border-radius:10px;background:var(--ds-surface-2);min-height:42px;color:var(--ds-ink)
}
.ds-check-wrap>.ds-check input{width:auto}

.ds-btn,.ds-link-btn{
  background:var(--ds-surface);border:1px solid var(--ds-border-2);padding:8px 14px;font-size:13px;font-weight:600;color:var(--ds-ink);
  cursor:pointer;border-radius:6px;font-family:inherit;transition:all .12s;display:inline-flex;align-items:center;gap:6px;justify-content:center;text-decoration:none;white-space:nowrap
}
.ds-btn:hover,.ds-link-btn:hover{background:var(--ds-surface-2);border-color:var(--ds-blue-mid);color:var(--ds-blue)}
.ds-btn-primary{background:var(--ds-blue);color:#fff;border-color:var(--ds-blue)}
.ds-btn-primary:hover{background:var(--ds-blue-dark);border-color:var(--ds-blue-dark);color:#fff}
.ds-btn-light,.ds-btn-outline{background:var(--ds-surface);color:var(--ds-blue);border-color:var(--ds-blue)}
.ds-btn-light:hover,.ds-btn-outline:hover{background:var(--ds-blue-light);color:var(--ds-blue-dark);border-color:var(--ds-blue-dark)}

.ds-dropzone{
  border:2px dashed var(--ds-border-2);background:var(--ds-surface-2);border-radius:14px;padding:22px;text-align:center;cursor:pointer;transition:all .15s ease
}
.ds-dropzone:hover,.ds-dropzone.over{border-color:var(--ds-blue);background:var(--ds-blue-light)}
.ds-drop-icon{font-size:32px;margin-bottom:6px}
.ds-drop-title{font-size:15px;font-weight:700}
.ds-drop-sub{font-size:12px;color:var(--ds-ink-3);margin-top:4px}
.ds-file-meta{margin-top:12px;padding:12px 14px;border-radius:12px;background:var(--ds-green-bg);border:1px solid #bbf7d0;font-size:13px}

.ds-preview-wrap{display:flex;flex-direction:column;gap:10px}
.ds-preview-wrap canvas{width:100%;height:auto;max-height:560px;object-fit:contain;border:1px solid var(--ds-border);border-radius:8px;background:#7f8794}
.ds-preview-meta{font-size:12px;color:var(--ds-ink-3)}

.ds-filters{display:grid;grid-template-columns:repeat(4,minmax(120px,1fr));gap:10px;margin-bottom:12px}
.ds-results-bar{font-size:12px;color:var(--ds-ink-3);margin-bottom:10px}
.ds-table-wrap{overflow:auto;background:var(--ds-surface);border:1px solid var(--ds-border);border-radius:12px}
.ds-table{width:max(100%,1280px);border-collapse:collapse;font-size:13px}
.ds-table th{
  text-align:left;padding:10px 14px;font-size:10px;text-transform:uppercase;letter-spacing:.5px;color:var(--ds-ink-3);
  background:var(--ds-surface-2);border-bottom:1px solid var(--ds-border);font-weight:700;white-space:nowrap
}
.ds-table td{padding:12px 14px;border-bottom:1px solid var(--ds-border);font-size:13px;vertical-align:top}
.ds-table tr:last-child td{border-bottom:0}
.ds-table tr:hover td{background:var(--ds-surface-2)}
.ds-table-compact th:nth-child(1){width:220px}
.ds-table-compact th:nth-child(2){width:220px}
.ds-table-compact th:nth-child(3){width:80px}
.ds-table-compact th:nth-child(4){width:72px}
.ds-table-compact th:nth-child(5){width:120px}
.ds-table-compact th:nth-child(6){width:140px}
.ds-table-compact th:nth-child(7){width:180px}
.ds-table-compact th:nth-child(8){width:130px}
.ds-table-compact th:nth-child(9){width:260px}
.ds-table-compact td{overflow:hidden;text-overflow:ellipsis}
.ds-cell-id strong,.ds-cell-doc span{display:block;overflow:hidden;text-overflow:ellipsis}
.ds-registry-actions{display:flex;flex-wrap:wrap;gap:6px}

.ds-mini-btn{
  background:var(--ds-surface);border:1px solid var(--ds-blue);color:var(--ds-blue);padding:6px 9px;border-radius:8px;
  font-size:12px;font-weight:600;cursor:pointer;transition:all .12s ease
}
.ds-mini-btn:hover{background:var(--ds-blue-light);color:var(--ds-blue-dark);border-color:var(--ds-blue-dark)}
.ds-mini-btn-danger{border-color:#f2b5b5;color:var(--ds-red)}
.ds-mini-btn-danger:hover{background:var(--ds-red-bg);border-color:var(--ds-red);color:var(--ds-red)}

.ds-badge,.ds-status-active,.ds-status-withdraw,.ds-status-lost,.ds-status-destroyed,.ds-status-replaced{
  display:inline-flex;align-items:center;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:700;white-space:nowrap
}
.ds-status-active{background:var(--ds-green-bg);color:var(--ds-green)}
.ds-status-withdraw{background:var(--ds-amber-bg);color:var(--ds-amber)}
.ds-status-lost{background:#fff7cc;color:#8a6800}
.ds-status-destroyed{background:var(--ds-red-bg);color:var(--ds-red)}
.ds-status-replaced{background:var(--ds-purple-bg);color:var(--ds-purple)}
.ds-type-operational{background:var(--ds-green-bg);color:var(--ds-green)}
.ds-type-training{background:#fff7cc;color:#8a6800}

.ds-stat{
  background:var(--ds-surface);border:1px solid var(--ds-border);border-radius:10px;padding:16px 18px;transition:border-color .15s
}
.ds-stat:hover{border-color:var(--ds-blue-mid)}
.ds-stat-val{font-size:26px;font-weight:700;letter-spacing:-.5px;line-height:1;color:var(--ds-blue-dark)}
.ds-stat-lbl{font-size:11px;color:var(--ds-ink-3);text-transform:uppercase;letter-spacing:.6px;font-weight:700;margin-top:6px}

.ds-list-placeholder{color:var(--ds-ink-3);font-size:13px}
.ds-event-item,.ds-history-item{padding:12px 0;border-bottom:1px solid var(--ds-border)}
.ds-event-item:last-child,.ds-history-item:last-child{border-bottom:0}
.ds-history-title{font-weight:700}
.ds-history-meta{font-size:12px;color:var(--ds-ink-3);margin-top:2px}
.ds-history-body{margin-top:6px;font-size:13px;color:var(--ds-ink-2)}

.ds-modal{position:fixed;inset:0;background:rgba(15,15,12,.5);z-index:100;display:flex;align-items:center;justify-content:center;padding:16px}
.ds-modal.hidden{display:none}
.ds-modal-box,.ds-modal-card{
  background:var(--ds-surface);border-radius:12px;padding:24px;width:100%;box-shadow:0 24px 60px rgba(0,0,0,.2);max-height:90vh;overflow-y:auto;border:1px solid var(--ds-border)
}
.ds-modal-box{max-width:600px}
.ds-modal-box-wide{max-width:760px}
.ds-icon-btn{background:var(--ds-surface);border:1px solid var(--ds-border-2);width:28px;height:28px;border-radius:6px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;color:var(--ds-ink-2)}
.ds-icon-btn:hover{background:var(--ds-surface-2);color:var(--ds-blue)}

.ds-details-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:8px}
.ds-detail-card{background:var(--ds-surface-2);border:1px solid var(--ds-border);border-radius:10px;padding:14px}
.ds-detail-label{font-size:11px;color:var(--ds-ink-3);text-transform:uppercase;letter-spacing:.5px;font-weight:700;margin-bottom:4px}
.ds-detail-value{font-weight:700;word-break:break-word;color:var(--ds-ink)}
.ds-history-list-compact{margin-top:10px}

.ds-generated-files{margin-top:16px;padding-top:16px;border-top:1px solid var(--ds-border)}
.ds-files-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.ds-file-card{border:1px solid var(--ds-border);border-radius:12px;padding:12px;background:var(--ds-surface-2)}
.ds-file-name{font-weight:700;word-break:break-word}
.ds-file-sub{font-size:12px;color:var(--ds-ink-3);margin-top:4px}

.ds-toast{position:fixed;bottom:24px;right:24px;background:var(--ds-ink);color:#fff;padding:12px 18px;border-radius:8px;font-size:13px;z-index:200;box-shadow:0 10px 30px rgba(0,0,0,.2);transform:translateY(100px);opacity:0;transition:all .25s}
.ds-toast.show{transform:translateY(0);opacity:1}

.docustamp-login-msg{padding:18px;background:#fff8e6;border:1px solid #f2ddb0;border-radius:12px}
.hidden{display:none !important}
.ds-mt-16{margin-top:16px}

@media (max-width: 1100px){
  .ds-grid-2{grid-template-columns:1fr}
  .ds-grid-4,.ds-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ds-filters{grid-template-columns:repeat(2,minmax(160px,1fr))}
  .ds-details-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width: 782px){
  .ds-topbar{height:auto;padding:14px 16px;align-items:flex-start;flex-direction:column}
  .ds-userbox{min-width:0;width:100%}
  .ds-tabs{padding:10px 16px;overflow:auto;flex-wrap:nowrap}
  .ds-panel{padding:18px 16px}
  .ds-form-grid,.ds-filters,.ds-grid-4,.ds-stat-grid,.ds-files-grid,.ds-details-grid{grid-template-columns:1fr}
  .ds-span-2{grid-column:span 1}
  .ds-row-between{align-items:flex-start}
  .ds-card{padding:16px}
}
