:root {
  --red: #c81432;
  --green: #13a66b;
  --amber: #e59a2f;
  --ink: #171717;
  --muted: #737373;
  --line: #e8e8e8;
  --bg: #f5f5f5;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: linear-gradient(145deg, #f7f7f7 0%, #ffffff 52%, #fff1f3 100%);
}

.login-locked .login-screen {
  display: flex;
}

.login-locked .sidebar,
.login-locked .workspace {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 22px;
}

.login-brand span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.login-status {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.emergency-login {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.emergency-login summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.emergency-login label {
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

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

button {
  cursor: pointer;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  padding: 24px 16px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

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

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

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: block;
  width: 100%;
  height: 44px;
  margin-bottom: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: #444444;
  background: transparent;
  text-align: left;
}

.nav.active,
.nav:hover {
  color: var(--red);
  background: #fff1f3;
  font-weight: 700;
}

.workspace {
  margin-left: 232px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
}

.operator {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cloud-box {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr auto auto auto;
  gap: 10px;
  align-items: end;
}

.cloud-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

#cloudStatusDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aaaaaa;
}

#cloudStatusDot.on {
  background: var(--green);
}

#cloudStatusDot.error {
  background: var(--red);
}

.cloud-box label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.cloud-box input {
  height: 36px;
  margin-top: 6px;
}

.cloud-box button {
  height: 36px;
  white-space: nowrap;
}

.current-admin {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric,
.board,
.editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.metric {
  padding: 20px;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  display: block;
  margin-top: 12px;
  color: var(--red);
  font-size: 32px;
}

.split {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor {
  padding: 18px;
}

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

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.section-actions button {
  min-width: 88px;
}

.filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  background: #fafafa;
}

.filterbar input,
.filterbar select {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 14px;
  color: #333333;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 20, 50, 0.08);
}

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

.primary,
.ghost,
.danger,
.approve {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary {
  width: 100%;
  height: 44px;
  color: #ffffff;
  background: var(--red);
}

.ghost {
  color: var(--red);
  border-color: #f0bcc5;
  background: #fff7f8;
}

.approve {
  color: #ffffff;
  background: var(--green);
}

.danger {
  color: #ffffff;
  background: #666666;
}

.board {
  padding: 18px;
  overflow: hidden;
}

.table {
  overflow-x: auto;
}

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

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

.selectable-table th:first-child,
.selectable-table td:first-child {
  width: 42px;
}

.row-check {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--red);
}

th {
  color: var(--muted);
  background: #fafafa;
  font-weight: 700;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 190px;
}

.actions button {
  min-width: 72px;
}

.user-cell {
  min-width: 160px;
}

.user-cell strong,
.user-cell small {
  display: block;
}

.user-cell small {
  max-width: 220px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
  word-break: break-all;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
}

.status.on {
  color: var(--green);
  background: #eaf8f1;
}

.status.pending {
  color: var(--amber);
  background: #fff5e6;
}

.status.off {
  color: #777777;
  background: #eeeeee;
}

.preview {
  display: none;
  width: 100%;
  max-height: 180px;
  margin: -4px 0 14px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.preview.visible {
  display: block;
}

.file-pill {
  display: none;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: #f6f6f6;
  font-size: 13px;
}

.file-pill.visible {
  display: block;
}

.settings-preview dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px 18px;
  margin: 0;
}

.settings-preview dt {
  color: var(--muted);
  font-size: 14px;
}

.settings-preview dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  word-break: break-word;
}

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

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    margin-left: 0;
    padding: 18px;
  }

  .metrics,
  .split,
  .filterbar,
  .cloud-box {
    grid-template-columns: 1fr;
  }

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