* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #1c1f23;
  background: #f5f6f8;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: #1c1f23;
  color: #fff;
}
header h1 { margin: 0; font-size: 1.1rem; font-weight: 600; }
#user-bar { display: flex; align-items: center; gap: 0.75rem; }
#user-bar button { background: #2a2f37; color: #fff; border: 0; padding: 0.25rem 0.6rem; border-radius: 4px; cursor: pointer; }

main { height: calc(100vh - 56px); }
#login-view { max-width: 360px; margin: 4rem auto; background: #fff; padding: 2rem; border-radius: 6px; }
#login-form { display: flex; flex-direction: column; gap: 0.75rem; }
#login-form label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.25rem; }
#login-form input { padding: 0.5rem; border: 1px solid #d4d7dd; border-radius: 4px; }
#login-form button { padding: 0.6rem; border: 0; background: #1c1f23; color: #fff; border-radius: 4px; cursor: pointer; }
.hint { color: #6b7280; font-size: 0.8rem; }

#main-view { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
#sidebar { background: #fff; border-right: 1px solid #e1e4e8; padding: 1rem; display: flex; flex-direction: column; min-height: 0; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; flex-shrink: 0; }
.sidebar-header h2 { font-size: 0.85rem; text-transform: uppercase; color: #6b7280; margin: 0; }
#new-project-btn { background: #1c1f23; color: #fff; border: 0; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; flex-shrink: 0; }
#new-project-btn:hover { background: #000; }
#projects-list { list-style: none; padding: 0; margin: 0; flex: 1 1 auto; overflow-y: auto; min-height: 2rem; }
#projects-list li { padding: 0.4rem 0.6rem; border-radius: 4px; cursor: pointer; }
#projects-list li.active { background: #1c1f23; color: #fff; }
#projects-list li:hover:not(.active) { background: #eef0f3; }
#sidebar-footer { border-top: 1px solid #eef0f3; padding-top: 0.75rem; margin-top: 0.75rem; flex-shrink: 0; }
#sidebar-footer button { width: 100%; background: #fff; border: 1px solid #d4d7dd; padding: 0.4rem; border-radius: 4px; cursor: pointer; }
#sidebar-footer button:hover { background: #f5f6f8; }
#sidebar .empty-list-hint { color: #9ca3af; font-size: 0.85rem; padding: 0.5rem 0.6rem; font-style: italic; }

#detail { padding: 1.25rem 1.5rem; overflow: auto; }
#detail-empty { color: #6b7280; padding: 4rem 0; text-align: center; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; background: none; color: inherit; padding: 0; }
.detail-header h2 { margin: 0 0 0.25rem; }
.muted { color: #6b7280; font-size: 0.9rem; }
.detail-actions button { background: #fff; border: 1px solid #d4d7dd; padding: 0.4rem 0.8rem; border-radius: 4px; cursor: pointer; }
.detail-actions button.danger { color: #b91c1c; border-color: #fecaca; }

#env-tabs { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
#env-tabs button { background: #fff; border: 1px solid #d4d7dd; padding: 0.3rem 0.7rem; border-radius: 999px; cursor: pointer; }
#env-tabs button.active { background: #1c1f23; color: #fff; border-color: #1c1f23; }
#env-tabs .env-add { border-style: dashed; color: #6b7280; }

.secrets-toolbar { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.secrets-toolbar input { flex: 1; padding: 0.5rem; border: 1px solid #d4d7dd; border-radius: 4px; }
.secrets-toolbar button { padding: 0.5rem 1rem; background: #1c1f23; color: #fff; border: 0; border-radius: 4px; cursor: pointer; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; }
th, td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid #eef0f3; }
th { background: #f5f6f8; font-size: 0.8rem; text-transform: uppercase; color: #6b7280; }
tr:last-child td { border-bottom: 0; }
.row-actions button { background: transparent; border: 0; color: #1c1f23; cursor: pointer; margin-right: 0.5rem; }
.row-actions button.danger { color: #b91c1c; }

dialog { border: 0; border-radius: 6px; padding: 1.5rem; min-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
dialog form { display: flex; flex-direction: column; gap: 0.75rem; }
dialog label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.25rem; }
dialog input, dialog textarea { padding: 0.5rem; border: 1px solid #d4d7dd; border-radius: 4px; font-family: ui-monospace, monospace; }
dialog menu { display: flex; justify-content: flex-end; gap: 0.5rem; margin: 0; padding: 0; }
dialog button { padding: 0.4rem 0.8rem; border: 0; border-radius: 4px; cursor: pointer; }
dialog button[type="submit"] { background: #1c1f23; color: #fff; }
#versions-list { background: #f5f6f8; border-radius: 4px; padding: 0.5rem; }
#versions-list .v { display: flex; justify-content: space-between; padding: 0.25rem 0; font-family: ui-monospace, monospace; font-size: 0.85rem; }
#versions-list button { background: transparent; border: 0; color: #1c1f23; cursor: pointer; }
