:root {
  --bg: #f5f2eb;
  --surface: #fffaf1;
  --surface-strong: #ffffff;
  --ink: #171717;
  --muted: #6d675f;
  --line: #ded7cc;
  --accent: #0f8f83;
  --accent-dark: #0b6f67;
  --gold: #b8892d;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(31, 24, 12, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Tahoma, Arial, sans-serif;
}

a {
  color: inherit;
}

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: 280px;
  padding: 24px;
  background: #171717;
  color: #fffaf1;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #16120a;
  font-weight: 800;
}

.brand small,
.account span,
.page-header p,
.project-card p,
td small {
  color: var(--muted);
}

.sidebar .brand small,
.sidebar .account span {
  color: #d4cab9;
}

nav {
  display: grid;
  gap: 8px;
}

nav a,
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 700;
  background: var(--surface-strong);
  cursor: pointer;
}

nav a {
  justify-content: flex-start;
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button:hover,
nav a:hover {
  transform: translateY(-1px);
}

.account {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.14);
  display: grid;
  gap: 4px;
}

.app-shell {
  margin-inline-start: 280px;
  padding: 34px;
}

.auth-shell,
.install-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card,
.install-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 22px;
  align-items: stretch;
}

.install-card {
  display: block;
  max-width: 560px;
  background: var(--surface-strong);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-copy,
.panel,
.form-panel {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-copy {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 440px;
  background: #171717;
  color: #fffaf1;
}

.login-copy p {
  color: #d4cab9;
  line-height: 1.9;
}

.eyebrow {
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.35;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 20px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-header p {
  max-width: 720px;
  line-height: 1.8;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.form-panel {
  padding: 22px;
}

.form-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: #2c2a26;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(15, 143, 131, .16);
  border-color: var(--accent);
}

.upload-panel {
  display: grid;
  grid-template-columns: 1fr 180px 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #efe8da;
  color: #4d4437;
  font-weight: 700;
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  text-decoration: none;
  font-weight: 700;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(31, 24, 12, .05);
}

.project-card strong {
  font-size: 18px;
}

.project-card p {
  margin: 8px 0 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stats div {
  padding: 16px;
  background: #f8f1e5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats strong {
  display: block;
  font-size: 25px;
}

.stats span {
  color: var(--muted);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.preline {
  white-space: pre-line;
  line-height: 1.9;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.flash {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 13px 15px;
  border: 1px solid #c6eadf;
  background: #eaf8f3;
  color: #075c52;
  font-weight: 700;
}

.flash.error,
.danger {
  border-color: #ffd2cc;
  background: #fff0ee;
  color: var(--danger);
}

.link-danger {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
}

code {
  direction: ltr;
  display: inline-block;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .app-shell {
    margin-inline-start: 0;
    padding: 18px;
  }

  .login-card,
  .grid.two,
  .upload-panel {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 260px;
    padding: 28px;
  }

  .page-header,
  .project-card {
    flex-direction: column;
  }
}
