:root {
  --coral: #fb5b62;
  --app-top: #16264e;
  --app-bot: #0e1a38;
  --panel: #172a52;
  --panel-2: #1b3060;
  --tile: #16294f;
  --border: #2b3f6d;
  --border-soft: #24375f;
  --cyan: #3ed5e8;
  --cyan-text: #5fd9e9;
  --text: #eaf1ff;
  --text-dim: #8ba0c8;
  --text-mute: #6c7fa6;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Poppins", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--coral);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.frame {
  min-height: 100%;
  padding: 26px;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  background: linear-gradient(160deg, var(--app-top), var(--app-bot));
  border-radius: 22px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 300px;
  grid-template-rows: 66px 1fr;
  min-height: 760px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-row: 1 / 3;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 26px;
}
.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  color: var(--cyan-text);
}
.nav { display: flex; flex-direction: column; gap: 10px; }
.nav-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-btn.active { color: var(--cyan); background: rgba(62, 213, 232, 0.12); }

/* ---------- Topbar ---------- */
.topbar {
  grid-column: 2 / 4;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border-soft);
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(320px, 60%);
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  color: var(--text-mute);
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input {
  border: 0; background: transparent; outline: none;
  color: var(--text); font: inherit; width: 100%;
}
.search input::placeholder { color: var(--text-mute); }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 600;
  color: #0e1a38;
  background: linear-gradient(150deg, var(--cyan), #8be7f1);
}

/* ---------- Content ---------- */
.content {
  grid-column: 2;
  grid-row: 2;
  padding: 30px 26px 36px;
  overflow-y: auto;
}
.page-head { display: flex; align-items: center; gap: 14px; }
.page-head h1 { margin: 0; font-size: 1.7rem; font-weight: 600; }
.badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  border: 1px solid rgba(62, 213, 232, 0.4);
  border-radius: 999px;
  padding: 5px 12px;
}
.subtitle {
  margin: 10px 0 26px;
  color: var(--text-dim);
  font-size: 0.92rem;
  max-width: 60ch;
  line-height: 1.6;
}

.panel {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 22px;
}
.panel-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 16px;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 26px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--tile);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.tile:hover { border-color: #3a548c; }
.tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tile-icon { width: 30px; height: 30px; color: var(--text-dim); }
.tile-name { font-weight: 600; font-size: 0.95rem; }
.tile-status { font-size: 0.78rem; color: var(--text-mute); }
.tile.filled {
  border-color: var(--cyan);
  background: rgba(62, 213, 232, 0.08);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 24px -4px rgba(62, 213, 232, 0.4);
}
.tile.filled .tile-icon { color: var(--cyan); }
.tile.filled .tile-status { color: var(--cyan-text); }

.btn-primary {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  border: 1px solid var(--cyan);
  background: rgba(62, 213, 232, 0.14);
  color: var(--cyan-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn-primary:hover:not(:disabled) { background: rgba(62, 213, 232, 0.24); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: #3a548c; }

.status { margin: 12px 0 0; font-size: 0.85rem; color: var(--text-dim); min-height: 1.2em; }
.status.error { color: #ff8a8f; }
.status.working { color: var(--cyan-text); }

/* ---------- Report ---------- */
.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#reportFrame {
  width: 100%;
  height: 72vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

/* ---------- Commands ---------- */
.commands {
  grid-column: 3;
  grid-row: 2;
  background: rgba(255, 255, 255, 0.03);
  border-left: 1px solid var(--border-soft);
  padding: 26px 22px;
  overflow-y: auto;
}
.commands-title { font-size: 1rem; font-weight: 600; margin-bottom: 22px; }
.cmd-section { padding: 16px 0; border-top: 1px solid var(--border-soft); }
.cmd-section:first-of-type { border-top: 0; padding-top: 0; }
.cmd-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  padding: 6px 0;
  color: var(--text-dim);
}
.stat-val { font-weight: 600; color: var(--text); text-align: right; }
.stat-val.dim { color: var(--text-mute); font-weight: 500; }
.stat-val.cyan { color: var(--cyan-text); }
.stat-val.ok { color: var(--cyan); }

.text-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--tile);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}
.text-input:focus { border-color: var(--cyan); }
.hint { font-size: 0.72rem; color: var(--text-mute); margin: 8px 0 0; line-height: 1.5; }
.hint code { background: rgba(255, 255, 255, 0.08); padding: 1px 4px; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .frame { padding: 12px; }
  .app {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
    min-height: 0;
  }
  .sidebar,
  .topbar,
  .content,
  .commands {
    grid-column: auto;
    grid-row: auto;
  }
  .sidebar {
    flex-direction: row;
    justify-content: flex-start;
    gap: 16px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .nav { flex-direction: row; }
  .commands { border-left: 0; border-top: 1px solid var(--border-soft); }
  .tiles { grid-template-columns: 1fr; }
  #reportFrame { height: 80vh; }
}
