/* Cora UI v2 — Database (screen-scoped). Mobile first; desktop ≥1024px. */
.v2-db [hidden], .v2-db-form [hidden], .v2-db-err[hidden] { display: none !important; }
.v2-db__body { display: flex; flex-direction: column; gap: var(--v2-block-gap); padding-top: var(--v2-body-pt); }
.v2-db__body.is-busy { opacity: 0.6; transition: opacity 120ms; }
.v2-db .v2-ico, .v2-sheet .v2-db-tile .v2-ico { flex: none; }
.v2-db__google, .v2-db__new, .v2-db__bridgebtn { border-radius: 9999px; }
.v2-db__google { gap: 6px; padding-left: 6px; background: #fff; }
.v2-db__g { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 9999px; background: var(--v2-soft); color: #4285f4; font-size: 12px; font-weight: 700; position: relative; }
.v2-db__g::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 7px; height: 7px; border-radius: 9999px; background: var(--v2-faint-2); box-shadow: 0 0 0 2px #fff; }
.v2-db__g.is-big { width: 40px; height: 40px; font-size: 18px; flex: none; }
.v2-db__g.is-big::after { display: none; }

/* KPIs */
.v2-db-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v2-db-kpi { min-width: 0; padding: 10px 12px; border: 1px solid var(--v2-border); border-radius: 14px; background: #fff; display: flex; flex-direction: column; gap: 3px; }
.v2-db-kpi small { font-size: 11.5px; color: var(--v2-muted-2); }
.v2-db-kpi__v { display: flex; align-items: baseline; gap: 6px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.v2-db-kpi__v em { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--v2-muted-2); }
.v2-db-kpi__sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-db-kbar { display: flex; gap: 3px; height: 5px; margin-top: 3px; }
.v2-db-kbar i { border-radius: 2px; }
.v2-db-kbar.is-empty { border-radius: 9999px; background: var(--v2-soft-2); }
.v2-db-kmods { display: flex; gap: 4px; margin-top: 2px; }
.v2-db-kmods span { width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: var(--v2-soft); color: var(--v2-faint-2); }
.v2-db-kpi--ring { flex-direction: row; align-items: center; gap: 10px; }
.v2-db-ring { flex: none; width: 40px; height: 40px; transform: rotate(-90deg); }
.v2-db-ring__bg { fill: none; stroke: var(--v2-soft-2); stroke-width: 4.5; }
.v2-db-ring__fg { fill: none; stroke: var(--v2-green); stroke-width: 4.5; stroke-linecap: round; }
.v2-db-ring.is-warn .v2-db-ring__fg { stroke: var(--v2-amber); }

.v2-db-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--v2-soft); font-size: 12.5px; color: var(--v2-text-2); }
.v2-db-note .v2-ico { margin-top: 2px; color: var(--v2-muted); }

/* toolbar */
.v2-db-toolbar { display: flex; align-items: center; gap: 8px; }
.v2-db-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.v2-db-types { flex: 1; min-width: 0; }
.v2-db-type { gap: 6px; padding-left: 4px; }
.v2-db-type__ic { width: 22px; height: 22px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; background: var(--v2-soft); }
.v2-chip--active .v2-db-type__ic { background: var(--v2-lime); color: var(--v2-forest); }
.v2-db-type small { font-size: 11px; opacity: 0.7; }
.v2-db-view button { width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* grid cards */
.v2-db-tile { position: relative; flex: none; width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.v2-db-tile__dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 9999px; box-shadow: 0 0 0 2px #fff; background: var(--v2-faint-2); }
.v2-db-tile__dot.is-live { background: var(--v2-green); }
.v2-db-tile__dot.is-wait { background: #2563eb; }
.v2-db-tile__dot.is-err { background: var(--v2-red); }
.v2-db-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--v2-border); border-radius: 14px; background: #fff; cursor: pointer; }
.v2-db-card:hover { border-color: var(--v2-control); }
.v2-db-card__top { display: flex; align-items: flex-start; gap: 12px; }
.v2-db-card__t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.v2-db-card__t b { font-size: 13.5px; font-weight: 600; }
.v2-db-card__t small { font-size: 12px; color: var(--v2-muted-2); }
.v2-db-card__mods { min-height: 24px; }
.v2-db-card__foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--v2-line); margin-top: auto; }
.v2-db-card__foot small { font-size: 11.5px; color: var(--v2-muted-2); white-space: nowrap; }
.v2-db-sp { flex: 1; }
.v2-db-av { width: 24px; height: 24px; border-radius: 9999px; background: var(--v2-forest); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.v2-db-iconbtn { flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--v2-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.v2-db-iconbtn:hover { background: var(--v2-soft); color: var(--v2-text); }
.v2-db-iconbtn.is-box { border: 1px solid var(--v2-border-2); background: #fff; }
.v2-db-fix { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-size: 12px; }
.v2-db-fix button { height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: #b91c1c; color: #fff; font: 600 12px var(--v2-font); cursor: pointer; }
.v2-db-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.v2-db-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 9999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.v2-db-chip.is-plain { border: 1px dashed var(--v2-border-2); color: var(--v2-muted); font-weight: 500; }
.v2-db-chip.is-more { background: var(--v2-soft); color: var(--v2-muted); }
.v2-db-st { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 9999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--v2-soft); color: var(--v2-muted); }
.v2-db-st i { width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.v2-db-st.is-live { background: #f0fdf4; color: #15803d; }
.v2-db-st.is-wait { background: #eff6ff; color: #1d4ed8; }
.v2-db-st.is-err { background: #fef2f2; color: #b91c1c; }
.v2-db-st__t { font-size: 11.5px; font-weight: 600; color: var(--v2-muted); }
.v2-db-st__t.is-live { color: #15803d; }
.v2-db-st__t.is-wait { color: #1d4ed8; }
.v2-db-st__t.is-err { color: #b91c1c; }

/* list rows */
.v2-db-list .v2-row { padding-left: 12px; padding-right: 6px; cursor: pointer; }
.v2-db-row .v2-row__main { gap: 2px; }
.v2-db-row__meta { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.v2-db-row__meta small { font-size: 11.5px; color: var(--v2-muted-2); overflow: hidden; text-overflow: ellipsis; }
.v2-db-row .v2-db-chip { height: 20px; font-size: 11px; }
.v2-db-empty { padding: 28px 16px; }
.v2-db-empty b { display: block; font-size: 14px; }
.v2-db-empty p { margin: 4px auto 12px; max-width: 360px; font-size: 12.5px; color: var(--v2-muted-2); }
.v2-db-more { display: flex; justify-content: center; }

/* sheets */
.v2-db-err { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--v2-red-soft); color: #991b1b; font-size: 12.5px; }
.v2-db-sh__status { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--v2-soft); margin-bottom: 14px; }
.v2-db-sh__status > div { flex: 1; min-width: 0; }
.v2-db-sh__status b { display: block; font-size: 13.5px; }
.v2-db-sh__status small { font-size: 12px; color: var(--v2-muted-2); }
.v2-db-sh__status.is-err { background: #fef2f2; }
.v2-db-sh__status.is-err b { color: #b91c1c; }
.v2-db-sh__status.is-wait { background: #eff6ff; }
.v2-db-url { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 6px 0 12px; margin: 6px 0 8px; border: 1px solid var(--v2-border-2); border-radius: 10px; background: var(--v2-page); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--v2-text-2); }
.v2-db-url > span { flex: 1; min-width: 0; }
.v2-db-pvbtn { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.v2-db-preview iframe { width: 100%; height: 320px; border: 1px solid var(--v2-border); border-radius: 12px; background: #fff; }
.v2-db-preview:not(:empty) { margin-bottom: 12px; }
.v2-db-mpick { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.v2-db-mp { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--v2-border-2); border-radius: 9999px; background: #fff; font: 500 12.5px var(--v2-font); color: var(--v2-text); cursor: pointer; }
.v2-db-mp.is-on { font-weight: 600; }
.v2-db-mp:disabled { cursor: default; }
.v2-db-desc { margin: 6px 0 14px; font-size: 13px; color: var(--v2-text-2); white-space: pre-wrap; }
.v2-db-bsum { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 14px; }
.v2-db-bsum__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.v2-db-bsum small { font-size: 12px; color: var(--v2-muted-2); }
.v2-db-bsum__btns { display: flex; gap: 6px; margin-top: 4px; }
.v2-db-bsum.is-empty { align-items: flex-start; }
.v2-db-kvs { padding: 4px 12px; margin: 6px 0 14px; }
.v2-db-kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--v2-line); font-size: 13px; }
.v2-db-kv:last-child { border-bottom: 0; }
.v2-db-kv span { color: var(--v2-muted-2); }
.v2-db-kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.v2-db-sh__btns { display: flex; gap: 8px; }
.v2-db-sh__btns .v2-btn { flex: 1; }
.v2-db-form { display: flex; flex-direction: column; gap: 10px; }
.v2-db-form .v2-help { margin-top: -6px; }
.v2-db-steps { display: flex; gap: 4px; margin-bottom: 14px; }
.v2-db-steps i { flex: 1; height: 4px; border-radius: 9999px; background: var(--v2-soft-2); }
.v2-db-steps i.is-done { background: var(--v2-forest); }
.v2-db-steps i.is-cur { background: var(--v2-green); }
.v2-db-kinds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.v2-db-kind { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px; border: 1px solid var(--v2-border-2); border-radius: 12px; background: #fff; font: 600 13px var(--v2-font); color: var(--v2-text); text-align: left; cursor: pointer; }
.v2-db-kind[aria-checked="true"] { border-color: var(--v2-forest); box-shadow: 0 0 0 1px var(--v2-forest); }
.v2-db-ways { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.v2-db-way { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px; border: 1px solid var(--v2-border); border-radius: 12px; }
.v2-db-way b { font-size: 13px; }
.v2-db-way small { font-size: 12px; color: var(--v2-muted-2); }
.v2-db-wrap { flex-wrap: wrap; }
.v2-db-back { display: inline-flex; align-items: center; gap: 4px; margin-top: 14px; }
.v2-db-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.v2-db-opt { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; border: 1px solid var(--v2-border-2); border-radius: 12px; background: #fff; font: inherit; color: var(--v2-text); text-align: left; cursor: pointer; }
.v2-db-opt span { display: flex; flex-direction: column; min-width: 0; }
.v2-db-opt b { font-size: 13px; font-weight: 600; }
.v2-db-opt small { font-size: 11.5px; color: var(--v2-muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-db-opt[aria-checked="true"] { border-color: var(--v2-forest); box-shadow: 0 0 0 1px var(--v2-forest); background: #fafcf7; }
.v2-db-map { margin-top: 8px; }
.v2-db-map__r { display: grid; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1.2fr); align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--v2-line); font-size: 12.5px; }
.v2-db-map__r:first-child { border-top: 0; }
.v2-db-map__r .v2-input { height: 38px; font-size: 14px; }
.v2-db-gcard { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--v2-soft); }
.v2-db-gcard b { display: block; font-size: 13.5px; }
.v2-db-gcard small { font-size: 12px; color: var(--v2-muted-2); }
.v2-db-glist { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--v2-text-2); }
.v2-db-glist li { display: flex; gap: 8px; align-items: flex-start; }
.v2-db-glist .v2-ico { margin-top: 3px; color: var(--v2-green); }

@media (min-width: 1024px) {
  .v2-db-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .v2-db-kpi { padding: 12px 14px; min-height: 86px; justify-content: center; }
  .v2-db-kpi__v { font-size: 20px; }
  .v2-db-ring { width: 52px; height: 52px; }
  .v2-db-search { flex: 0 0 260px; margin-left: auto; }
  .v2-db-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
  .v2-db-kinds { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1023.98px) {
  .v2-db-kpi--ring .v2-db-ring { width: 34px; height: 34px; }
}

