:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --line: #d9e0e7;
  --text: #1f2933;
  --muted: #637083;
  --brand: #176b5d;
  --brand-dark: #0f4d43;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 12px 32px rgba(20, 32, 45, 0.08);
}

h1 {
  margin: 0;
  font-size: 24px;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
}

input,
button,
.button,
textarea {
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
textarea {
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.secondary:hover {
  background: #eef3f6;
}

.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.small {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.topbar,
.toolbar,
.file-card,
.editor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.toolbar {
  margin-top: 16px;
  padding: 14px;
}

.crumbs {
  margin-bottom: 12px;
  color: var(--muted);
}

.forms {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.forms form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-card {
  margin-top: 16px;
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 600;
  background: #f9fbfc;
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}

.actions form {
  display: inline-flex;
  gap: 6px;
}

.actions input {
  width: 150px;
  min-height: 30px;
  padding: 4px 7px;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef3f6;
  color: var(--muted);
  font-size: 11px;
}

.flash {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f9fbfc;
}

.flash.error {
  border-color: #f2b8b5;
  background: #fff2f1;
}

.flash.success {
  border-color: #b5dfcf;
  background: #effaf4;
}

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

.editor {
  margin-top: 16px;
  padding: 14px;
}

.editor textarea {
  width: 100%;
  min-height: 65vh;
  resize: vertical;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.editor button {
  margin-top: 12px;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 16px, 1120px);
    padding: 8px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    min-width: 220px;
    align-items: flex-start;
    flex-direction: column;
  }
}
