/* TugraPanel — light premium console */
:root {
  --tapp-bg: #f5f7fb;
  --tapp-card: #ffffff;
  --tapp-line: #e6eaf2;
  --tapp-text: #0b1220;
  --tapp-muted: #5b6b82;
  --tapp-accent: #0f766e;
  --tapp-accent-2: #0d9488;
  --tapp-navy: #0b1f3a;
  --tapp-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 28px rgba(15, 23, 42, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body.tapp {
  margin: 0;
  min-height: 100%;
  background: var(--tapp-bg);
  color: var(--tapp-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
}

.tapp-shell {
  min-height: 100dvh;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 calc(64px + var(--safe-b));
}

.tapp-appbar, .tapp-top, .tapp-top-min {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 0; padding: calc(8px + var(--safe-t)) 12px 10px;
  background: #fff; border-bottom: 1px solid var(--tapp-line);
}
.tapp-main { padding: 8px 0 12px; width: 100%; box-sizing: border-box; }
.tapp-brand-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tapp-brand-row img, .tapp-top-logo {
  width: 40px; height: 40px; border-radius: 12px; display: block;
  box-shadow: 0 6px 16px rgba(15, 118, 110, .18);
}
.tapp-brand-row strong { display: block; font-size: 16px; color: var(--tapp-navy); }
.tapp-brand-row span {
  display: block; font-size: 12px; color: var(--tapp-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58vw;
}
.tapp-live {
  font-size: 12px; font-weight: 700; color: #0f766e;
  background: #e7f8f5; border: 1px solid #c7efe8;
  border-radius: 999px; padding: 6px 11px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tapp-live::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: #10b981;
}
.tapp-top-title {
  flex: 1; text-align: center; font-size: 17px; font-weight: 700; color: var(--tapp-navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tapp-top-spacer { width: 40px; flex: 0 0 40px; }
.tapp-back {
  width: 40px; height: 40px; display: grid; place-items: center;
  color: var(--tapp-navy); text-decoration: none; border-radius: 12px;
  background: #f3f5f9; border: 1px solid var(--tapp-line);
}
.tapp-back svg { width: 20px; height: 20px; }

.tapp-hello h1, .tapp-dash-hero h1 {
  margin: 0 0 6px; font-size: 28px; font-weight: 750; letter-spacing: -.03em; color: var(--tapp-navy);
}
.tapp-dash-hero {
  background: #fff; border: 1px solid var(--tapp-line); border-radius: 20px;
  padding: 22px 20px; margin-bottom: 16px; box-shadow: var(--tapp-shadow);
}
.tapp-kicker {
  margin: 0 0 8px; font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: var(--tapp-accent);
}
.tapp-dash-hero p, .tapp-hello p, .tapp-lead {
  margin: 0; color: var(--tapp-muted); font-size: 14px; line-height: 1.5;
}
.tapp-lead { margin: 0 12px 16px; }

.tapp-res {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px;
}
.tapp-res-card {
  background: #fff; border: 1px solid var(--tapp-line); border-radius: 16px;
  padding: 14px 12px 12px; box-shadow: var(--tapp-shadow);
}
.tapp-res-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tapp-res-top span { font-size: 12px; color: var(--tapp-muted); font-weight: 650; }
.tapp-res-top strong { font-size: 20px; color: var(--tapp-navy); }
.tapp-res-track {
  height: 6px; border-radius: 99px; margin: 10px 0 8px; background: #eef2f7; overflow: hidden;
}
.tapp-res-track b {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #0d9488, #22c55e);
}
.tapp-res-card.warn .tapp-res-track b { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.tapp-res-card small { color: var(--tapp-muted); font-size: 11px; }

.tapp-sec {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 0 12px; font-size: 13px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: #334155;
}
.tapp-sec a { color: var(--tapp-accent); text-decoration: none; text-transform: none; letter-spacing: 0; font-weight: 700; }

.tapp-tools, .tapp-ico-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 22px;
}
.tapp-tool, .tapp-ico-tile {
  background: #fff; border: 1px solid var(--tapp-line); border-radius: 16px;
  padding: 14px 16px; min-height: 64px;
  text-decoration: none; color: inherit;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--tapp-shadow);
}
.tapp-tool b, .tapp-ico-tile b { display: block; font-size: 15px; color: var(--tapp-navy); }
.tapp-tool small, .tapp-ico-tile small { display: block; color: var(--tapp-muted); font-size: 12px; margin-top: 2px; }
.tapp-tool-copy { display: flex; flex-direction: column; min-width: 0; }
.tapp-tools-list .tapp-tool { min-height: 64px; }
.tapp-tool::after, .tapp-row::after {
  content: ''; width: 8px; height: 8px; margin-left: auto; flex: 0 0 8px;
  border-right: 2px solid #c5cdd8; border-top: 2px solid #c5cdd8; transform: rotate(45deg);
}
.tapp-row-stack::after, .tapp-row-file::after, .tapp-row-more::after { display: none; }
.tapp-tool-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 44px;
}
.tapp-tool-ico svg { width: 20px; height: 20px; }
.tapp-ico-tile em { display: none; }
.tone-teal .tapp-tool-ico { background: #e7f8f5; color: #0f766e; }
.tone-blue .tapp-tool-ico { background: #e8f4ff; color: #0369a1; }
.tone-amber .tapp-tool-ico { background: #fff6e5; color: #b45309; }
.tone-rose .tapp-tool-ico { background: #ffe8ee; color: #be123c; }
.tone-violet .tapp-tool-ico { background: #f1e9ff; color: #6d28d9; }
.tone-slate .tapp-tool-ico { background: #eef2f7; color: #334155; }

.tapp-list { margin-top: 4px; }
.tapp-list h2 {
  margin: 0 0 10px; font-size: 13px; color: #334155;
  font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.tapp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; margin-bottom: 10px; border-radius: 16px;
  background: #fff; border: 1px solid var(--tapp-line);
  text-decoration: none; color: inherit; box-shadow: var(--tapp-shadow);
}
.tapp-row small { color: var(--tapp-muted); }
.tapp-row-sub { display: block; color: var(--tapp-muted); font-size: 12px; font-weight: 400; margin-top: 3px; }
.tapp-row-stack { align-items: flex-start; flex-wrap: wrap; }
.tapp-row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tapp-row-file { align-items: center; }
.tapp-row-more { justify-content: center; color: var(--tapp-accent); font-weight: 700; }
.tapp-empty { color: var(--tapp-muted); font-size: 14px; padding: 20px 4px; text-align: center; }
.tapp-muted { color: var(--tapp-muted); font-size: 13px; margin: 0 0 4px; }
.tapp-h2 { margin: 0 0 12px; font-size: 18px; color: var(--tapp-navy); }

.tapp-card {
  background: #fff; border: 1px solid var(--tapp-line); border-radius: 18px;
  padding: 18px; margin: 0 0 14px; box-shadow: var(--tapp-shadow);
}
.tapp-card p { margin: 0 0 8px; font-size: 14px; color: var(--tapp-muted); }
.tapp-card p:last-child { margin-bottom: 0; }
.tapp-card p strong { color: var(--tapp-text); }

.tapp-cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 22px; border-radius: 14px; border: 0;
  background: var(--tapp-accent); color: #fff; font-weight: 750; text-decoration: none;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .22);
}
.tapp-cta-block { width: 100%; margin-top: 10px; cursor: pointer; }
.tapp-cta-ghost { background: #fff; color: #be123c; border: 1px solid #fecdd3; box-shadow: none; }
.tapp-btn {
  min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid #c7efe8; background: #e7f8f5; color: #0f766e; font-weight: 700; cursor: pointer;
}
.tapp-link-btn { border: 0; background: transparent; color: var(--tapp-muted); font-size: 13px; padding: 8px 4px; cursor: pointer; }

.tapp-label { display: block; font-size: 13px; color: var(--tapp-muted); margin: 12px 0 6px; font-weight: 650; }
.tapp-input {
  width: 100%; min-height: 50px; border-radius: 14px;
  border: 1px solid #d7dee8; background: #fff; color: var(--tapp-text); padding: 0 14px; font-size: 16px;
}
.tapp-input:focus { outline: 0; border-color: #0d9488; box-shadow: 0 0 0 4px rgba(13, 148, 136, .12); }
select.tapp-input { appearance: none; }
.tapp-check { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-size: 14px; color: var(--tapp-muted); }
.tapp-search { margin: 0 12px 8px; }
.tapp-inline { display: flex; gap: 8px; margin-bottom: 10px; align-items: stretch; }
.tapp-inline .tapp-input, .tapp-inline .tapp-file { flex: 1; min-width: 0; }
.tapp-file { width: 100%; color: var(--tapp-muted); font-size: 13px; }
.tapp-path {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  color: #0f766e; background: #e7f8f5; border: 1px solid #c7efe8;
  border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; word-break: break-all;
}

.tapp-alert {
  background: #fff1f2; color: #9f1239; border-radius: 12px;
  padding: 12px; margin-bottom: 12px; font-size: 14px; border: 1px solid #fecdd3;
}
.tapp-alert.ok { background: #e7f8f5; color: #115e59; border-color: #c7efe8; }

.tapp-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: stretch;
  gap: 0;
  padding: 4px 2px calc(4px + var(--safe-b));
  background: #fff; border-top: 1px solid var(--tapp-line);
  max-width: none; margin: 0; border-radius: 0;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .04);
}
.tapp-tabbar-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.tapp-tabbar a, .tapp-tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: #7b8aa0;
  font-size: 10px; font-weight: 700; padding: 6px 0 4px; border-radius: 10px;
  background: transparent; border: 0; cursor: pointer; font-family: inherit;
  width: auto; min-width: 0; max-width: 100%;
  white-space: nowrap; line-height: 1.1;
  touch-action: manipulation;
}
.tapp-tabbar a span, .tapp-tabbar button span {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tapp-tabbar a svg, .tapp-tabbar button svg { width: 20px; height: 20px; flex: 0 0 20px; }
.tapp-tabbar a.active, .tapp-tabbar button.active { color: var(--tapp-accent); background: #e7f8f5; }

.tapp-auth { padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); }
.tapp-auth-hero { display: grid; place-items: center; padding: 28px 0 12px; }
.tapp-auth-hero img { width: 80px; height: 80px; border-radius: 22px; box-shadow: var(--tapp-shadow); }
.tapp-auth-card {
  background: #fff; border: 1px solid var(--tapp-line); border-radius: 24px;
  padding: 24px 20px; margin-top: 8px; box-shadow: var(--tapp-shadow);
}
.tapp-auth-card h1 { margin: 0 0 4px; font-size: 26px; color: var(--tapp-navy); }
.tapp-auth-sub { margin: 0 0 16px; color: var(--tapp-muted); font-size: 14px; }

.tapp-site-hero {
  background: #fff; border: 1px solid var(--tapp-line); border-radius: 20px;
  padding: 18px; margin-bottom: 16px; box-shadow: var(--tapp-shadow);
}
.tapp-site-hero h1 { margin: 0 0 12px; font-size: 20px; color: var(--tapp-navy); word-break: break-all; }
.tapp-site-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tapp-pill {
  font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px;
  background: #f3f5f9; color: #334155; border: 1px solid var(--tapp-line);
}
.tapp-pill.ok { background: #e7f8f5; color: #0f766e; border-color: #c7efe8; }
.tapp-pill.bad { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.tapp-mini-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  list-style: none; padding: 0; margin: 0;
}
.tapp-mini-stats li {
  background: #f5f7fb; border-radius: 12px; padding: 12px 8px;
  text-align: center; font-size: 12px; color: var(--tapp-muted);
}
.tapp-mini-stats b { display: block; color: var(--tapp-navy); font-size: 16px; margin-bottom: 2px; }

.tapp-kv { list-style: none; padding: 0; margin: 0; }
.tapp-kv li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--tapp-line); font-size: 14px;
}
.tapp-kv li:last-child { border-bottom: 0; }
.tapp-kv span { color: var(--tapp-muted); }
.tapp-log {
  background: #0b1220; border-radius: 14px; padding: 14px;
  font-size: 12px; line-height: 1.45; overflow: auto; max-height: 52vh;
  color: #e2e8f0; white-space: pre-wrap; word-break: break-word;
}
.tapp-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tapp-metric {
  position: relative; overflow: hidden; background: #fff;
  border: 1px solid var(--tapp-line); border-radius: 16px; padding: 14px 12px 16px;
  box-shadow: var(--tapp-shadow);
}
.tapp-metric span { display: block; font-size: 12px; color: var(--tapp-muted); }
.tapp-metric strong { display: block; font-size: 18px; margin-top: 4px; color: var(--tapp-navy); }
.tapp-metric i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--tapp-accent); }

.tapp-ico-grid-wide { grid-template-columns: 1fr; }
.tapp-hero-card, .tapp-tile, .tapp-grid, .tapp-ico { }
.tapp-splash { display: none; }

.tapp-drawer-ov {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .45);
}
.tapp-drawer-ov.open { display: block; }
.tapp-drawer {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
  width: min(86vw, 340px); background: #0b1f3a; color: #e8eef5;
  transform: translateX(-105%); transition: transform .22s ease;
  display: flex; flex-direction: column;
  padding: calc(12px + var(--safe-t)) 0 calc(12px + var(--safe-b));
  box-shadow: 16px 0 40px rgba(0,0,0,.25);
}
.tapp-drawer.open { transform: translateX(0); }
.tapp-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.tapp-drawer-head strong { font-size: 16px; }
.tapp-drawer-x {
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.08); color: #fff; font-size: 22px; cursor: pointer;
}
.tapp-drawer-nav { flex: 1; overflow: auto; padding: 8px 10px 16px; }
.tapp-drawer-lab {
  margin: 14px 8px 6px; font-size: 11px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: #7f91a8;
}
.tapp-drawer-nav a {
  display: block; padding: 12px 12px; border-radius: 12px;
  color: #d5dee8; text-decoration: none; font-weight: 700; font-size: 15px;
}
.tapp-drawer-nav a:hover, .tapp-drawer-nav a:active { background: rgba(13,148,136,.18); color: #fff; }
.tapp-drawer-out { padding: 10px 16px 0; border-top: 1px solid rgba(255,255,255,.08); }
.tapp-drawer-out button {
  width: 100%; min-height: 44px; border: 0; border-radius: 12px;
  background: rgba(244,63,94,.16); color: #fecaca; font-weight: 800; cursor: pointer;
}
body.tapp-drawer-open { overflow: hidden; }

.tapp-dash-hero-sm { padding: 16px 14px; margin-bottom: 12px; }
.tapp-dash-hero-sm h1 { font-size: 22px; }
.tapp-count { margin: 10px 12px 8px; font-size: 12px; font-weight: 700; color: var(--tapp-muted); }
.tapp-sites { display: flex; flex-direction: column; gap: 0; }
.tapp-site {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 0; border-bottom: 1px solid var(--tapp-line); border-radius: 0;
  padding: 14px 12px; text-decoration: none; color: inherit;
  box-shadow: none;
}
.tapp-site-main { flex: 1; min-width: 0; }
.tapp-site-main strong {
  display: block; font-size: 15px; color: var(--tapp-navy);
  letter-spacing: -.02em; word-break: break-all;
}
.tapp-site-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tapp-chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 999px;
  border: 1px solid #e2e8f0; background: #f8fafc; color: #334155;
}
.tapp-chip.php { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.tapp-chip.ok { background: #ecfdf5; border-color: #bbf7d0; color: #047857; }
.tapp-chip.warn { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.tapp-chip.bad { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.tapp-site-go {
  flex: 0 0 auto; background: #0d9488; color: #fff; font-size: 12px; font-weight: 800;
  padding: 8px 10px; border-radius: 10px;
}
.tapp-site.is-off { opacity: .78; }

/* Desktop safety: /app/login should not hug left edge */
@media (min-width: 900px) {
  body.tapp .tapp-auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 440px;
    margin: 0 auto;
    padding: 32px 16px;
  }
  body.tapp .tapp-auth-card {
    width: 100%;
    max-width: 400px;
  }
}
