/* =====================================================================
   TPCloud Object Storage Portal — Design System v2
   components.css: Reusable UI components
   ===================================================================== */

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-title-row .card-title { margin-bottom: 0; }
.card-flush { padding: 0; }
.card-flush .tbl-wrap table { border-radius: 0; }

.card-success { border-color: var(--green-border); background: #F0FDF4; }
.card-warning { border-color: var(--amber-border); background: #FFFBEB; }
.card-danger  { border-color: var(--red-border);   background: #FFF7F7; }
.card-info    { border-color: var(--blue-border);  background: var(--blue-bg); }
.card-success .card-title { color: var(--green-dark); }
.card-warning .card-title { color: #9A3412; }
.card-danger  .card-title { color: var(--red-dark); }
.card-info    .card-title { color: var(--blue-dark); }

/* ── KPI / Metric cards ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
.kpi-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  padding: 16px 20px;
}
.kpi-card.kpi-green  { border-left-color: var(--green); }
.kpi-card.kpi-amber  { border-left-color: var(--amber); }
.kpi-card.kpi-red    { border-left-color: var(--red); }
.kpi-card.kpi-blue   { border-left-color: var(--brand); }
.kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.kpi-unit {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 3px;
}
.kpi-sub { font-size: 12px; color: var(--text-muted); }

/* ── Grid helpers ────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
  vertical-align: middle;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 1px 2px rgba(37,99,235,.35); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,.45); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-med);
}
.btn-secondary:hover { background: var(--hover-bg); color: var(--text); }

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

.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }

.btn-warning { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn-warning:hover { background: #B45309; border-color: #B45309; color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-full { width: 100%; justify-content: center; }

.btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ── Status badges — dot + text, no colored pills ────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-active    { color: var(--green-dark); }
.badge-active::before { background: var(--green); }
.badge-success   { color: var(--green-dark); }
.badge-success::before { background: var(--green); }
.badge-suspended { color: var(--amber-dark); }
.badge-suspended::before { background: var(--amber); }
.badge-disabled  { color: var(--amber-dark); }
.badge-disabled::before { background: var(--amber); }
.badge-warning   { color: var(--amber-dark); }
.badge-warning::before { background: var(--amber); }
.badge-running   { color: var(--amber-dark); }
.badge-running::before { background: var(--amber); }
.badge-deleted   { color: var(--red-dark); }
.badge-deleted::before { background: var(--red); }
.badge-revoked   { color: var(--amber-dark); }
.badge-revoked::before { background: var(--amber); }
.badge-danger    { color: var(--red-dark); }
.badge-danger::before { background: var(--red); }
.badge-failed    { color: var(--red-dark); }
.badge-failed::before { background: var(--red); }
.badge-error     { color: var(--red-dark); }
.badge-error::before { background: var(--red); }
.badge-neutral   { color: var(--text-muted); }
.badge-neutral::before { background: var(--text-faint); }

/* ── Alerts / Notices ────────────────────────────────────────────── */
.notice {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.notice-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 3px;
}
.notice-success {
  background: #F0FDF4;
  border-color: var(--green-border);
  color: var(--green-dark);
}
.notice-warning {
  background: #FFFBEB;
  border-color: var(--amber-border);
  color: var(--amber-dark);
}
.notice-danger {
  background: #FFF7F7;
  border-color: var(--red-border);
  color: var(--red-dark);
}
.notice-info {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue-dark);
}
.alert,
.notice.notice-danger,
.notice.notice-warning {
  box-sizing: border-box;
}

/* ── Action zones (lifecycle/danger sections) ────────────────────── */
.action-zone {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--r);
  padding: 20px 22px;
  margin-bottom: 16px;
  background: var(--surface);
}
.action-zone-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}
.action-zone-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.action-zone.zone-danger {
  border-left-color: var(--red);
  border-color: var(--red-border);
  background: #FFF7F7;
}
.action-zone.zone-danger .action-zone-title { color: var(--red-dark); }
.action-zone.zone-warning {
  border-left-color: var(--amber);
  border-color: var(--amber-border);
  background: #FFFBEB;
}
.action-zone.zone-warning .action-zone-title { color: #9A3412; }
.action-zone.zone-info {
  border-left-color: var(--brand);
  border-color: var(--blue-border);
  background: var(--blue-bg);
}
.action-zone.zone-info .action-zone-title { color: var(--blue-dark); }
.action-zone.zone-success {
  border-left-color: var(--green);
  border-color: var(--green-border);
  background: #F0FDF4;
}
.action-zone.zone-success .action-zone-title { color: var(--green-dark); }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-field { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
select,
textarea {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
  -webkit-appearance: none;
  appearance: none;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):disabled,
select:disabled {
  background: var(--surface2);
  color: var(--text-muted);
  cursor: not-allowed;
}
input[type="checkbox"],
input[type="radio"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--brand);
  flex-shrink: 0;
  margin: 0;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
textarea { resize: vertical; min-height: 76px; }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Input suffix (e.g. GiB, days units) */
.input-suffix {
  padding: 9px 14px;
  border: 1px solid var(--border-med);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.input-with-suffix {
  display: flex;
  align-items: stretch;
}
.input-with-suffix input {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  flex: 1;
  min-width: 0;
}

/* Input prefix group (e.g. tenant-code- prefix) */
.input-prefix-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color 0.14s, box-shadow 0.14s;
  background: var(--surface);
}
.input-prefix-group:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
}
.input-prefix {
  padding: 9px 12px;
  background: var(--surface2);
  border-right: 1px solid var(--border-med);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: 'Menlo', 'Consolas', monospace;
}
.input-prefix-group input {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex: 1;
  min-width: 0;
}
.input-prefix-group input:focus { box-shadow: none !important; }

/* Confirm / checkbox row */
.confirm-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  margin: 12px 0;
  line-height: 1.5;
}
.confirm-row input[type="checkbox"] { margin-top: 3px; }
.confirm-row.confirm-danger  { background: #FFF7F7; border-color: var(--red-border); }
.confirm-row.confirm-warning { background: #FFFBEB; border-color: var(--amber-border); }

/* Required field marker */
label:has(+ input:required)::after {
  content: " *";
  color: red;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--hover-bg); }
tbody tr[data-row-href] { cursor: pointer; }

/* ── Smart table: search + sort + pagination ─────────────────────── */
.tbl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 14px;
}

.tbl-search {
  width: 200px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
}
.tbl-search:focus { outline: none; border-color: var(--brand); }
.tbl-search::placeholder { color: var(--text-muted); }

th[data-col-sort] { cursor: pointer; user-select: none; }
th[data-col-sort]::after { content: ' ⇅'; font-size: 9px; opacity: 0.35; }
th[data-col-sort][data-sort-dir="asc"]::after  { content: ' ↑'; opacity: 1; color: var(--brand); }
th[data-col-sort][data-sort-dir="desc"]::after { content: ' ↓'; opacity: 1; color: var(--brand); }

/* Shared pagination (matches ra-pagination link style) */
.tbl-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.tbl-pagination[hidden] { display: none; }
.tbl-pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tbl-pagination-pages button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.tbl-pagination-pages button:hover { background: var(--hover-bg); color: var(--text); }
.tbl-pagination-pages button.active { background: var(--brand); color: #fff; }
.tbl-pagination-pages button:disabled { opacity: .4; cursor: default; pointer-events: none; }

/* ── Code / Pre ──────────────────────────────────────────────────── */
code {
  background: none;
  /* background: #eef3ff; */
  /* border: 1px solid #dbeafe; */
  /* color: #1e3a8a; */
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
pre {
  background: #0F172A;
  color: #E2E8F0;
  padding: 18px 22px;
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-size: 12.5px;
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  line-height: 1.7;
}

/* ── Credential display (show-once) ──────────────────────────────── */
.cred-block {
  background: #0F172A;
  border: 1px solid #334155;
  border-radius: var(--r-sm);
  padding: 16px 20px;
  margin: 12px 0;
}
.cred-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cred-row:last-child { border-bottom: none; }
.cred-key {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748B;
  min-width: 120px;
  padding-top: 1px;
}
.cred-val {
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: #E2E8F0;
  word-break: break-all;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 52px 24px;
}
.empty-icon {
  width: 48px;
  height: 48px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  margin: 0 auto 16px;
}
.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── Disclosure (danger details/summary) ─────────────────────────── */
details.danger-disc {
  display: block !important;
  margin: 14px 0 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid #fecaca !important;
  border-left: 4px solid #ef4444 !important;
  border-radius: 14px !important;
  background: #fffafa !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.035) !important;
}

details.danger-disc > summary {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 12px 16px !important;
  min-height: 44px !important;
  cursor: pointer !important;
  color: #991b1b !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  background: #fff7f7 !important;
  list-style: none !important;
}

details.danger-disc > summary::-webkit-details-marker { display: none !important; }

details.danger-disc > summary::before {
  content: "−" !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 999px !important;
  background: #fee2e2 !important;
  color: #991b1b !important;
  font-weight: 700 !important;
  flex: 0 0 auto !important;
}

details.danger-disc:not([open]) > summary::before { content: "+" !important; }

details.danger-disc[open] > summary {
  border-bottom: 1px solid #fee2e2 !important;
}

details.danger-disc > form,
details.danger-disc > .disc-body {
  display: block !important;
  margin: 0 !important;
  padding: 16px 18px 18px !important;
  background: #fffafa !important;
  box-sizing: border-box !important;
}

details.danger-disc > form .form-group,
details.danger-disc > .disc-body .form-group,
details.danger-disc > form .form-field,
details.danger-disc > .disc-body .form-field {
  margin: 0 0 14px !important;
}

details.danger-disc > form label,
details.danger-disc > .disc-body label,
details.danger-disc > form .form-label,
details.danger-disc > .disc-body .form-label {
  display: block !important;
  margin: 0 0 6px !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

details.danger-disc > form input:not([type="checkbox"]),
details.danger-disc > .disc-body input:not([type="checkbox"]),
details.danger-disc > form textarea,
details.danger-disc > .disc-body textarea,
details.danger-disc > form select,
details.danger-disc > .disc-body select,
details.danger-disc > form .form-control,
details.danger-disc > .disc-body .form-control {
  width: 100% !important;
  box-sizing: border-box !important;
}

details.danger-disc > form .confirm-row,
details.danger-disc > .disc-body .confirm-row,
details.danger-disc > form .confirm-danger,
details.danger-disc > .disc-body .confirm-danger {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin: 12px 0 14px !important;
  padding: 12px 14px !important;
  border: 1px solid #fecaca !important;
  border-radius: 12px !important;
  background: #fff7f7 !important;
}

details.danger-disc > form .confirm-row input[type="checkbox"],
details.danger-disc > .disc-body .confirm-row input[type="checkbox"],
details.danger-disc > form .confirm-danger input[type="checkbox"],
details.danger-disc > .disc-body .confirm-danger input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
}

details.danger-disc > form .confirm-row label,
details.danger-disc > .disc-body .confirm-row label,
details.danger-disc > form .confirm-danger label,
details.danger-disc > .disc-body .confirm-danger label {
  margin: 0 !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.45 !important;
}

details.danger-disc > form .btn,
details.danger-disc > .disc-body .btn,
details.danger-disc > form button,
details.danger-disc > .disc-body button {
  margin-top: 2px !important;
}

/* ── Divider ─────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Utilities ───────────────────────────────────────────────────── */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--text-muted); }
.text-sec { color: var(--text-sec); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-danger  { color: var(--red-dark); }
.text-warning { color: var(--amber-dark); }
.text-success { color: var(--green-dark); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.link-plain { color: inherit; text-decoration: none; }
.link-plain:hover { text-decoration: none; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.flex   { display: flex; }
.items-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ── Inline form (select + save side-by-side) ────────────────────── */
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.inline-form select { flex: 1; min-width: 0; }

/* ── Dots action button ──────────────────────────────────────────── */
.btn-dots {
  background: none;
  border: 1px solid transparent;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
  letter-spacing: 0.05em;
  line-height: 1;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
  flex-shrink: 0;
}
.btn-dots:hover,
.btn-dots.active {
  background: var(--hover-bg);
  border-color: var(--border);
  color: var(--text);
}

/* ── Dropdown action menu ────────────────────────────────────────── */
.actions-cell {
  position: relative;
  text-align: right;
  white-space: nowrap;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 10px 25px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);
  z-index: 200;
  min-width: 168px;
  padding: 4px 0;
  text-align: left;
}
.dropdown-menu.show {
  display: block;
  animation: ddFadeIn 0.12s ease-out;
}
@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: block;
  transition: background 0.1s;
  text-decoration: none;
  line-height: 1.4;
}
.dropdown-item:hover:not(:disabled) {
  background: var(--hover-bg);
  text-decoration: none;
}
.dropdown-item.danger           { color: var(--red); }
.dropdown-item.danger:hover:not(:disabled) { background: var(--red-bg); }
.dropdown-item:disabled         { color: var(--text-faint); cursor: not-allowed; }

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

/* Tooltip on disabled dropdown items */
.dd-tip-wrap {
  position: relative;
  display: block;
}
.dd-tip-text {
  visibility: hidden;
  width: 220px;
  background: var(--text);
  color: #fff;
  text-align: left;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  position: absolute;
  z-index: 400;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.14s;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: var(--sh);
}
.dd-tip-text::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-left-color: var(--text);
}
.dd-tip-wrap:hover .dd-tip-text {
  visibility: visible;
  opacity: 1;
}

/* ── Modal overlay + dialog ──────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.38);
  backdrop-filter: blur(3px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
  animation: overlayFadeIn 0.15s ease-out;
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 60px rgba(13,21,38,0.30);
  animation: modalSlideIn 0.18s ease-out;
  overflow: hidden;
}
.modal.modal-sm { max-width: 380px; }
.modal.modal-md { max-width: 520px; }
@keyframes modalSlideIn {
  from { transform: scale(0.96) translateY(-6px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--hover-bg); color: var(--text); }

.modal-body {
  padding: 22px;
}
.modal-body .form-field:last-child { margin-bottom: 0; }

.modal-footer {
  padding: 14px 22px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Upload file explorer section  */
.upload-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
}

.upload-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.destination-badge {
  background: #f1f5f9;
  color: #334155;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
}

/* Production-grade Custom Drag & Drop / File Input Zone */
.dropzone-container {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  background: #f8fafc;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 16px;
}

.dropzone-container:hover, .dropzone-container.dragover {
  border-color: var(--brand);
  background: rgba(var(--brand-rgb, 37, 99, 235), 0.02);
}

/* Completely hide default input but keep it functionally active */
.hidden-file-input {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.dropzone-icon {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--brand);
  display: block;
}

.dropzone-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main, #0f172a);
  margin-bottom: 4px;
}

.file-selected-name {
  display: none;
  background: #e2e8f0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  word-break: break-all;
  margin-top: 8px;
}

/* Compact Informational Alert Banners */
.alert-banner {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.btn-upload {
  min-width: 140px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
}

/* ── Change Password Modal ─────────────────────────────────────── */
.cp-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
  animation: cp-fadein 0.15s ease;
}
.cp-modal-overlay[hidden] { display: none !important; }

@keyframes cp-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cp-modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--r);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22), 0 4px 16px rgba(15, 23, 42, 0.1);
  animation: cp-slidein 0.15s ease;
}

@keyframes cp-slidein {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.cp-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cp-modal-hd-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cp-modal-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}
.cp-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.cp-modal-close:hover { background: var(--hover-bg); color: var(--text); }

.cp-modal-body {
  padding: 18px 18px 0;
}

.cp-modal-security {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 16px 18px 0;
  padding: 9px 12px;
  background: var(--blue-bg, #EFF6FF);
  border: 1px solid var(--blue-border, #BFDBFE);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--blue-dark, #1D4ED8);
  line-height: 1.5;
}

.cp-modal-ft {
  display: flex;
  gap: 8px;
  padding: 16px 18px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Inline copy button (shared across pages) ─────────────────────── */
.copy-icon-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}

.copy-icon-btn:hover {
  background: var(--hover-bg);
  color: var(--text);
  border-color: var(--border-med);
}

.copy-icon-btn.copied {
  color: var(--green);
  border-color: var(--green-border);
}