/*
 * Orbita UI kit - shared variables and component classes for the shell and every app.
 * Baseline: iOS Safari 10.3. No flex "gap", no inset, no clamp/min/max, no backdrop-filter.
 * Animate only transform / opacity.
 */

:root {
  /* surfaces */
  --ob-bg: #0b0e14;
  --ob-bg-2: #10141d;
  --ob-surface: #161b26;
  --ob-surface-2: #1e2533;
  --ob-surface-3: #293245;
  --ob-line: #2a3345;
  --ob-line-soft: #1f2634;
  /* text */
  --ob-text: #e9edf5;
  --ob-text-2: #b3bccd;
  --ob-muted: #7d889d;
  /* accents */
  --ob-accent: #4fd8c4;
  --ob-accent-dim: #2b8f83;
  --ob-accent-ink: #052320;
  --ob-amber: #f2b55a;
  --ob-ok: #56d68a;
  --ob-warn: #f2b55a;
  --ob-danger: #ff6b6b;
  --ob-info: #6aa8ff;
  /* shape */
  --ob-radius: 14px;
  --ob-radius-sm: 10px;
  --ob-radius-xs: 6px;
  --ob-bar-h: 48px;
  --ob-tap: 44px;
  /* type */
  --ob-font: -apple-system, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --ob-mono: Menlo, Monaco, "SF Mono", Consolas, "Courier New", monospace;
}

*, *::before, *::after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  touch-action: manipulation;
}

body {
  margin: 0;
  font-family: var(--ob-font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ob-text);
  background: var(--ob-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}

input, textarea, .ob-selectable {
  -webkit-user-select: text;
  user-select: text;
}

[hidden] { display: none !important; }

/* ---------- layout helpers ---------- */

.ob-row { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
.ob-col { display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; }
.ob-grow { -webkit-flex: 1 1 0%; flex: 1 1 0%; min-width: 0; min-height: 0; }
.ob-wrap { -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.ob-center { text-align: center; }
.ob-right { text-align: right; }
.ob-fill { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }

/* spacing between siblings (flex gap is not available on Safari 10) */
.ob-row > .ob-gap + .ob-gap, .ob-row.ob-spaced > * + * { margin-left: 10px; }
.ob-col.ob-spaced > * + * { margin-top: 10px; }
.ob-mt { margin-top: 12px; }
.ob-mb { margin-bottom: 12px; }
.ob-ml { margin-left: 10px; }
.ob-mr { margin-right: 10px; }

/* Scroll containers (momentum scrolling). The shell lets a touch drag scroll any element whose computed
   overflow is auto/scroll and whose content overflows on the axis of the drag. */
.ob-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ob-scroll-x {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* A full-height scrolling page with comfortable padding (typical app root). */
.ob-page {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px 40px;
}
.ob-page-inner { max-width: 760px; margin: 0 auto; }

/* ---------- text ---------- */

.ob-h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.3px; }
.ob-h2 { font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.ob-section-title {
  font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ob-muted); margin: 22px 4px 8px;
}
.ob-muted { color: var(--ob-muted); }
.ob-text-2 { color: var(--ob-text-2); }
.ob-small { font-size: 13px; }
.ob-mono { font-family: var(--ob-mono); }
.ob-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-ok { color: var(--ob-ok); }
.ob-warn { color: var(--ob-warn); }
.ob-danger { color: var(--ob-danger); }
.ob-accent { color: var(--ob-accent); }

/* ---------- buttons ---------- */

.ob-btn {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  min-height: var(--ob-tap);
  min-width: var(--ob-tap);
  padding: 0 18px;
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-radius-sm);
  background: var(--ob-surface-2);
  color: var(--ob-text);
  font-size: 16px; font-weight: 500; line-height: 1.2;
  text-align: center; text-decoration: none; white-space: nowrap;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  -webkit-transition: opacity .12s, -webkit-transform .12s;
  transition: opacity .12s, transform .12s;
}
.ob-btn.is-pressed, .ob-btn:active { opacity: .7; -webkit-transform: scale(.97); transform: scale(.97); }
.ob-btn[disabled], .ob-btn.is-disabled { opacity: .4; pointer-events: none; }
.ob-btn--primary { background: var(--ob-accent); border-color: var(--ob-accent); color: var(--ob-accent-ink); font-weight: 600; }
.ob-btn--danger { background: transparent; border-color: var(--ob-danger); color: var(--ob-danger); }
.ob-btn--ghost { background: transparent; border-color: transparent; color: var(--ob-accent); }
.ob-btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.ob-btn--block { display: -webkit-flex; display: flex; width: 100%; }
.ob-btn--icon { padding: 0; width: var(--ob-tap); }
/* Safari 10 does not lay out the children of a <button> as flex items: keep icon + label inline so the
   button looks the same with and without flex. */
.ob-btn svg { width: 22px; height: 22px; display: inline-block; vertical-align: middle; -webkit-flex: none; flex: none; }
.ob-btn > span { display: inline-block; vertical-align: middle; }
.ob-btn svg + span, .ob-btn span + svg { margin-left: 8px; }
.ob-btn + .ob-btn { margin-left: 10px; }
.ob-btn--block + .ob-btn--block { margin-left: 0; margin-top: 10px; }

/* ---------- form controls ---------- */

.ob-field { display: block; margin-bottom: 14px; }
.ob-label { display: block; font-size: 13px; font-weight: 500; color: var(--ob-text-2); margin: 0 2px 6px; }
.ob-hint { display: block; font-size: 13px; color: var(--ob-muted); margin: 6px 2px 0; }

.ob-input, .ob-select, .ob-textarea {
  display: block; width: 100%;
  min-height: var(--ob-tap);
  padding: 10px 12px;
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-radius-sm);
  background: var(--ob-bg-2);
  color: var(--ob-text);
  font-size: 16px; /* >= 16px: iOS does not zoom on focus */
  line-height: 1.3;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.ob-textarea { min-height: 96px; resize: none; }
.ob-input:focus, .ob-select:focus, .ob-textarea:focus { border-color: var(--ob-accent); }
.ob-input::-webkit-input-placeholder, .ob-textarea::-webkit-input-placeholder { color: var(--ob-muted); }
.ob-input::placeholder, .ob-textarea::placeholder { color: var(--ob-muted); }
.ob-input.is-invalid, .ob-select.is-invalid, .ob-textarea.is-invalid { border-color: var(--ob-danger); }
.ob-select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237d889d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* toggle: <label class="ob-switch"><input type="checkbox"><i></i><span>Texto</span></label> */
.ob-switch { display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; min-height: var(--ob-tap); }
.ob-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ob-switch i {
  position: relative; display: block; width: 50px; height: 30px; border-radius: 15px;
  background: var(--ob-surface-3); -webkit-flex: none; flex: none;
}
.ob-switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px;
  background: var(--ob-text);
  -webkit-transition: -webkit-transform .15s; transition: transform .15s;
}
.ob-switch input:checked + i { background: var(--ob-accent-dim); }
.ob-switch input:checked + i::after { -webkit-transform: translateX(20px); transform: translateX(20px); }
.ob-switch span { margin-left: 12px; }

/* ---------- cards ---------- */

.ob-card {
  background: var(--ob-surface);
  border: 1px solid var(--ob-line-soft);
  border-radius: var(--ob-radius);
  padding: 16px;
  margin-bottom: 14px;
}
.ob-card--flush { padding: 0; overflow: hidden; }
.ob-card-title { font-size: 16px; font-weight: 600; margin: 0 0 10px; }

/* key/value rows: <div class="ob-kv"><span>Etiqueta</span><b>Valor</b></div> */
.ob-kv {
  display: -webkit-flex; display: flex; -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: baseline; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--ob-line-soft);
}
.ob-kv:last-child { border-bottom: 0; }
.ob-kv > span { color: var(--ob-muted); margin-right: 16px; -webkit-flex: none; flex: none; }
.ob-kv > b { font-weight: 500; text-align: right; min-width: 0; word-break: break-word; }

/* ---------- lists ---------- */

.ob-list {
  list-style: none; margin: 0 0 14px; padding: 0;
  background: var(--ob-surface);
  border: 1px solid var(--ob-line-soft);
  border-radius: var(--ob-radius);
  overflow: hidden;
}
.ob-item {
  position: relative;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ob-line-soft);
}
.ob-item:last-child { border-bottom: 0; }
.ob-item--tap { cursor: pointer; }
.ob-item--tap.is-pressed, .ob-item--tap:active { background: var(--ob-surface-2); }
.ob-item.is-active { background: var(--ob-surface-2); }
.ob-item-icon {
  -webkit-flex: none; flex: none; width: 36px; height: 36px; margin-right: 12px; border-radius: 18px;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  background: var(--ob-surface-3); color: var(--ob-text);
}
.ob-item-icon svg { width: 20px; height: 20px; display: block; }
.ob-item-main { -webkit-flex: 1 1 0%; flex: 1 1 0%; min-width: 0; }
.ob-item-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-item-sub { font-size: 13px; color: var(--ob-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-item-end { -webkit-flex: none; flex: none; margin-left: 12px; color: var(--ob-muted); font-size: 14px; }

/* ---------- tabs ---------- */

.ob-tabs {
  display: -webkit-flex; display: flex;
  background: var(--ob-bg-2);
  border: 1px solid var(--ob-line-soft);
  border-radius: var(--ob-radius-sm);
  padding: 3px;
  margin-bottom: 14px;
}
.ob-tab {
  -webkit-flex: 1 1 0%; flex: 1 1 0%;
  min-height: var(--ob-tap); padding: 0 12px;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--ob-muted); font-size: 15px; font-weight: 500; white-space: nowrap;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.ob-tab.is-active { background: var(--ob-surface-3); color: var(--ob-text); }

/* ---------- small bits ---------- */

.ob-chip {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--ob-surface-3); color: var(--ob-text-2);
}
.ob-chip--ok { background: rgba(86, 214, 138, .16); color: var(--ob-ok); }
.ob-chip--warn { background: rgba(242, 181, 90, .16); color: var(--ob-warn); }
.ob-chip--danger { background: rgba(255, 107, 107, .16); color: var(--ob-danger); }
.ob-chip--info { background: rgba(106, 168, 255, .16); color: var(--ob-info); }

.ob-dot { display: inline-block; width: 9px; height: 9px; border-radius: 5px; background: var(--ob-muted); vertical-align: middle; }
.ob-dot--ok { background: var(--ob-ok); }
.ob-dot--warn { background: var(--ob-warn); }
.ob-dot--danger { background: var(--ob-danger); }

.ob-badge {
  display: inline-block; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--ob-danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
}

.ob-progress { height: 6px; border-radius: 3px; background: var(--ob-surface-3); overflow: hidden; }
.ob-progress > i {
  display: block; height: 100%; width: 100%; background: var(--ob-accent); border-radius: 3px;
  -webkit-transform-origin: 0 50%; transform-origin: 0 50%;
  /* set transform: scaleX(0..1) from JS */
  -webkit-transform: scaleX(0); transform: scaleX(0);
}

.ob-spinner {
  display: inline-block; width: 26px; height: 26px; border-radius: 13px;
  border: 3px solid var(--ob-surface-3); border-top-color: var(--ob-accent);
  -webkit-animation: ob-spin .8s linear infinite; animation: ob-spin .8s linear infinite;
}
@-webkit-keyframes ob-spin { to { -webkit-transform: rotate(360deg); } }
@keyframes ob-spin { to { transform: rotate(360deg); } }

.ob-empty { padding: 48px 20px; text-align: center; color: var(--ob-muted); }
.ob-empty svg { width: 48px; height: 48px; display: block; margin: 0 auto 12px; opacity: .6; }

.ob-toolbar {
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  min-height: 52px; padding: 4px 12px;
  background: var(--ob-bg-2); border-bottom: 1px solid var(--ob-line-soft);
}
.ob-toolbar > * + * { margin-left: 8px; }

.ob-divider { height: 1px; background: var(--ob-line-soft); margin: 14px 0; border: 0; }

/* ---------- modal sheet ---------- */

.ob-sheet-wrap {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 60;
  display: -webkit-flex; display: flex;
  -webkit-justify-content: center; justify-content: center;
  -webkit-align-items: flex-start; align-items: flex-start;
  padding: 7% 16px 16px;
  background: rgba(4, 6, 10, .66);
  -webkit-animation: ob-fade .14s ease-out; animation: ob-fade .14s ease-out;
}
.ob-sheet {
  width: 100%; max-width: 440px; max-height: 100%;
  display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column;
  background: var(--ob-surface);
  border: 1px solid var(--ob-line);
  border-radius: 18px;
  -webkit-animation: ob-rise .18s ease-out; animation: ob-rise .18s ease-out;
}
.ob-sheet--wide { max-width: 640px; }
.ob-sheet-head { padding: 18px 20px 0; -webkit-flex: none; flex: none; }
.ob-sheet-title { font-size: 19px; font-weight: 600; margin: 0; }
.ob-sheet-msg { margin: 8px 0 0; color: var(--ob-text-2); white-space: pre-line; }
.ob-sheet-body { padding: 16px 20px 4px; overflow-y: auto; -webkit-overflow-scrolling: touch; -webkit-flex: 1 1 auto; flex: 1 1 auto; min-height: 0; }
.ob-sheet-foot {
  display: -webkit-flex; display: flex; -webkit-justify-content: flex-end; justify-content: flex-end;
  padding: 12px 20px 18px; -webkit-flex: none; flex: none;
}
.ob-sheet .ob-list { background: var(--ob-bg-2); }

@-webkit-keyframes ob-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ob-fade { from { opacity: 0; } to { opacity: 1; } }
@-webkit-keyframes ob-rise { from { opacity: 0; -webkit-transform: translate3d(0, 14px, 0); } to { opacity: 1; -webkit-transform: translate3d(0, 0, 0); } }
@keyframes ob-rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }

/* ---------- toast ---------- */

.ob-toast {
  max-width: 80%; margin-top: 8px; padding: 11px 18px;
  border-radius: 22px; border: 1px solid var(--ob-line);
  background: var(--ob-surface-3); color: var(--ob-text);
  font-size: 15px; text-align: center;
  -webkit-animation: ob-rise .18s ease-out; animation: ob-rise .18s ease-out;
  -webkit-transition: opacity .2s; transition: opacity .2s;
}
.ob-toast--ok { border-color: var(--ob-ok); }
.ob-toast--error { border-color: var(--ob-danger); }
.ob-toast.is-leaving { opacity: 0; }
