:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #16211f;
  --muted: #68716e;
  --line: #ddd8ce;
  --accent: #243f36;
  --accent-soft: #e7eee9;
  --danger: #8a2f2f;
  --success: #2f6d45;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--accent);
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: #14211d;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand strong {
  display: block;
  font-size: 1.25rem;
}

.brand span,
.sidebar-note {
  color: rgba(255,255,255,0.72);
  font-size: 0.85rem;
}

.workspace-chip {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 12px;
}

.workspace-chip span {
  display: block;
  color: rgba(255,255,255,0.65);
  font-size: 0.76rem;
  margin-bottom: 4px;
}

.workspace-chip strong {
  font-size: 0.94rem;
}

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

.nav a {
  color: #fff;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
}

.nav a:hover {
  background: rgba(255,255,255,0.08);
}

.main-content {
  flex: 1 1 auto;
  padding: 32px;
  min-width: 0;
}

.public-content {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

.login-card h1,
.page-header h1 {
  margin: 0 0 8px;
}

.lead {
  color: var(--muted);
  margin-top: 0;
}

.boundary-box {
  background: var(--accent-soft);
  border: 1px solid #cbd9d0;
  border-radius: 14px;
  padding: 14px;
  font-size: 0.92rem;
  margin: 20px 0;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.span-2 {
  grid-column: span 2;
}

label {
  font-weight: 650;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button:hover {
  filter: brightness(1.05);
}

.button.secondary,
button.secondary,
.small-button.secondary {
  background: #eff3f0;
  color: var(--accent);
  border: 1px solid #cbd9d0;
}

.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 8px 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash-success {
  border-color: rgba(47,109,69,0.35);
  color: var(--success);
}

.flash-error {
  border-color: rgba(138,47,47,0.35);
  color: var(--danger);
}

.flash-notice {
  color: var(--muted);
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 18px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #cbd9d0;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.85rem;
  font-weight: 700;
}

.pill.small {
  padding: 4px 8px;
  font-size: 0.75rem;
  margin-left: 6px;
}

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

.help-text {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.actions-cell {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 840px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: auto;
  }

  .main-content {
    padding: 20px;
  }

  .grid-two,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
