/* Terraform app pages. Builds on theme.css. */

.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg-1); border-bottom: 1px solid var(--line); padding-top: var(--safe-top); }
.topbar-row { max-width: 1100px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; gap: 18px; }
.tf-button { display: inline-flex; align-items: center; padding: 4px 6px; border-radius: 8px; }
.tf-button:hover { background: var(--bg-2); }
.tf-button img { height: 22px; width: auto; display: block; }
.nav { display: flex; gap: 14px; flex: 1; overflow-x: auto; }
.nav a, .nav-right a { color: var(--fg-2); text-decoration: none; font-size: 13.5px; white-space: nowrap; }
.nav a:hover, .nav-right a:hover { color: var(--fg); }
.nav-right { display: flex; gap: 14px; align-items: center; }

.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 80px; }
.narrow { max-width: 460px; margin: 40px auto; }

.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.row.between { justify-content: space-between; align-items: center; }
.inline { display: inline; margin: 0; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--fg-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
input, textarea, select {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; color: var(--fg); font-size: 14px;
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.5; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--red-hi); box-shadow: 0 0 0 3px var(--red-soft); }

.button { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--red-hi); background: var(--red); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; font-size: 13.5px; }
.button:hover { background: var(--red-hi); }
.button.secondary { background: var(--bg-2); border-color: var(--line-2); color: var(--fg); }
.button.secondary:hover { background: var(--bg-3); }
.button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.linklike { background: none; border: none; color: var(--fg-2); cursor: pointer; padding: 0; font-size: 13.5px; }
.linklike:hover { color: var(--fg); }

.flash, .error { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash { background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.error { background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.ok { color: var(--ok); font-size: 12px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--bg-3); color: var(--fg-2); }

.list { list-style: none; padding: 0; margin: 0 0 20px; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--fg-3); font-weight: 600; font-size: 12px; }
.table.small td { font-size: 12px; }
.table tr.deny td { color: var(--danger); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--fg-3); }
.kv dd { margin: 0; }
.copyable { user-select: all; word-break: break-all; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; }
kbd { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-2); }

.md h1, .md h2, .md h3 { margin-top: 0.8em; }
.md p:last-child { margin-bottom: 0; }

/* Assistant */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.msg { padding: 12px 16px; border-radius: 12px; max-width: 760px; }
.msg .who { font-size: 11px; color: var(--fg-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; }
.msg.you { background: var(--bg-2); align-self: flex-end; }
.msg.bot { background: var(--bg-1); border: 1px solid var(--line); }
.tool-line { font-size: 12px; color: var(--fg-3); padding-left: 6px; }
.action-card { border: 1px solid var(--line-2); border-left: 3px solid var(--warn); border-radius: 10px; padding: 14px 16px; background: var(--bg-1); max-width: 760px; }
.action-card.executed { border-left-color: var(--ok); }
.action-card.failed, .action-card.cancelled, .action-card.expired { border-left-color: var(--fg-3); opacity: .85; }
.action-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); margin-bottom: 6px; }
.action-card.executed .action-head { color: var(--ok); }
.action-diff del { color: var(--fg-3); }

/* Terraform menu (spec §8.9) */
.tf-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.55); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.tf-menu { width: min(640px, calc(100vw - 32px)); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); overflow: hidden; }
.tf-input { width: 100%; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 16px 18px; font-size: 17px; }
.tf-input:focus { box-shadow: none; border-color: var(--line); }
.tf-results { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.tf-group { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px 4px; }
.tf-row { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.tf-row.tf-sel { background: var(--red-soft); }
.tf-row.tf-ask .tf-title { color: var(--red-hi); font-weight: 600; }
.tf-sub { font-size: 12px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-empty { padding: 14px 12px; color: var(--fg-3); }
.tf-hints { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 11.5px; color: var(--fg-3); }

/* Notebook */
.nb { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
@media (max-width: 760px) { .nb { grid-template-columns: 1fr; } }
.nb-folders { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nb-folders a { color: var(--fg-2); text-decoration: none; padding: 5px 8px; border-radius: 6px; font-size: 13.5px; }
.nb-folders a:hover { background: var(--bg-2); color: var(--fg); }
.nb-folders a.active { background: var(--red-soft); color: var(--fg); }
.nb-head { padding: 10px 8px 2px; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.thumb { max-width: 240px; max-height: 160px; border-radius: 6px; border: 1px solid var(--line); }

/* Secrets manager */
.secret-value { user-select: all; }
.recovery-key { font-size: 18px; letter-spacing: .06em; text-align: center; padding: 18px; }
