:root {
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  color: #e8edf5;
  background: #0d1117;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: #0d1117; }
button, input, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 10px;
  padding: .7rem 1rem;
  background: #2f81f7;
  color: white;
  cursor: pointer;
}
button.secondary { background: #30363d; }
button:hover { filter: brightness(1.08); }
.shell { max-width: 1180px; margin: 0 auto; padding: 28px 18px 60px; }
.topbar, .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.eyebrow { color: #8b949e; margin: 0 0 4px; font-size: .78rem; letter-spacing: .16em; }
h1 { margin: 0 0 24px; font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { margin-top: 0; }
.panel, .card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 14px;
  padding: 20px;
}
.narrow { max-width: 520px; margin: 30px auto; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: #c9d1d9; }
input, textarea {
  width: 100%;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #f0f6fc;
  border-radius: 9px;
  padding: .72rem .8rem;
}
input:focus, textarea:focus { outline: 2px solid #1f6feb; outline-offset: 1px; }
.muted { color: #8b949e; }
.hidden { display: none !important; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab { background: #21262d; }
.tab.active { background: #2f81f7; }
.grid { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.card span { display: block; color: #8b949e; font-size: .9rem; }
.card strong { display: block; margin-top: 8px; font-size: 1.7rem; }
.summary { white-space: pre-wrap; margin: 0; color: #c9d1d9; }
.message { min-height: 1.5em; color: #79c0ff; }
.small { font-size: .85rem; }
.form-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #0d1117;
}
.form-section h3 { margin: 0; }
.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-column > div { display: grid; gap: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px; border-bottom: 1px solid #30363d; text-align: left; vertical-align: top; }
th { color: #8b949e; font-weight: 600; }
.sort-button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8b949e;
  font-weight: 600;
  white-space: nowrap;
}
.sort-button:hover, .sort-button.active-sort { color: #f0f6fc; filter: none; }
a { color: #58a6ff; }
.session-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .session-actions { width: 100%; justify-content: space-between; }
  .two-column { grid-template-columns: 1fr; }
}

button.danger { background: #da3633; }
button.compact { padding: .38rem .62rem; font-size: .86rem; }
.inline-control {
  display: flex;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}
.inline-control input { width: auto; }
.retired-row { opacity: .58; }


/* Mobile-first usability improvements */
button {
  min-height: 44px;
  touch-action: manipulation;
}
button:disabled {
  cursor: progress;
  opacity: .62;
}
.topbar {
  position: relative;
}
.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 0;
  background: rgba(13, 17, 23, .96);
  backdrop-filter: blur(8px);
}
.tab {
  min-height: 42px;
}
.panel {
  margin-bottom: 18px;
}
.panel-head {
  margin-bottom: 14px;
}
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.row-actions {
  min-width: 180px;
}
.row-actions button {
  margin: 2px;
}
input, textarea, button {
  font-size: 16px;
}
input, textarea {
  min-height: 44px;
}
textarea {
  resize: vertical;
}
.table-wrap {
  scrollbar-width: thin;
}
.status-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 26px;
  margin: -10px 0 18px;
  color: #8b949e;
  font-size: .86rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  flex: 0 0 auto;
}
.status-dot.loading {
  background: #d29922;
}
.status-dot.error {
  background: #f85149;
}

@media (max-width: 760px) {
  .shell {
    padding: 16px 12px 40px;
  }
  h1 {
    margin-bottom: 8px;
    font-size: 1.6rem;
  }
  h2 {
    font-size: 1.15rem;
  }
  .topbar {
    gap: 8px;
    margin-bottom: 12px;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(88px, 1fr));
    overflow-x: auto;
    gap: 6px;
    margin: 0 -12px 14px;
    padding: 8px 12px;
  }
  .tab {
    white-space: nowrap;
    padding: .58rem .7rem;
    font-size: .9rem;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .card {
    padding: 14px;
  }
  .card strong {
    font-size: 1.35rem;
  }
  .panel {
    padding: 15px;
    border-radius: 12px;
  }
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .panel-head > button,
  .panel-head > .inline-control {
    width: 100%;
  }
  .inline-control {
    justify-content: flex-start;
  }
  .inline-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .inline-actions button,
  .stack > button,
  form > button {
    width: 100%;
  }
  .summary {
    font-size: .88rem;
    overflow-wrap: anywhere;
  }
  .session-actions {
    gap: 8px;
  }
  .session-actions #sessionUser {
    max-width: 62vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .table-wrap {
    overflow: visible;
  }
  table {
    min-width: 0;
  }
  table thead {
    display: none;
  }
  table,
  table tbody,
  table tr,
  table td {
    display: block;
    width: 100%;
  }
  table tr {
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid #30363d;
    border-radius: 12px;
    background: #0d1117;
  }
  table td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  table td::before {
    content: attr(data-label);
    color: #8b949e;
    font-size: .82rem;
    font-weight: 600;
  }
  table td.row-actions {
    display: block;
    min-width: 0;
    padding-top: 10px;
    border-top: 1px solid #30363d;
  }
  table td.row-actions::before {
    display: block;
    margin-bottom: 8px;
  }
  .row-actions button {
    width: 100%;
    margin: 4px 0;
  }
  td a {
    overflow-wrap: anywhere;
  }
  .form-section {
    padding: 12px;
  }
}

@media (max-width: 390px) {
  .metrics {
    grid-template-columns: 1fr;
  }
}

.budget-metrics .card small {
  display: block;
  margin-top: 8px;
  line-height: 1.45;
}
.budget-control {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #0d1117;
}
.budget-control[data-state="warning"] {
  border-color: #d29922;
}
.budget-control[data-state="hold"],
.budget-control[data-state="unknown"] {
  border-color: #f85149;
}
.budget-control p {
  margin: 8px 0 0;
}
.budget-breakdown {
  white-space: pre-line;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
