:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #132030;
  --muted: #566579;
  --line: #d7dee7;
  --brand: #14517a;
  --ok: #145a32;
  --warn: #7a1d1d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #eef4f8 0%, #f8fafc 100%);
}

.wrap {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.topbar {
  background: #0d2a3f;
  color: #eef6ff;
  border-bottom: 1px solid #0b2132;
}

.topbar .wrap {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav a,
.btn-link {
  color: #d7ecff;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.btn-link[disabled] {
  opacity: 0.72;
  cursor: not-allowed;
}

.nav a:hover,
a:hover {
  text-decoration: underline;
}

.main {
  padding: 22px 0 40px;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

.alert.success {
  background: #ecf8f0;
  border-color: #b8e5c6;
  color: var(--ok);
}

.alert.error {
  background: #fdeeee;
  border-color: #f3baba;
  color: var(--warn);
}

.toast-root {
  position: fixed;
  top: 74px;
  right: 20px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 24px));
}

.toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 10px 28px rgba(12, 28, 42, 0.2);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast.alert {
  margin-bottom: 0;
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-message {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast-close {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.form-loading-hint {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

.is-loading {
  opacity: 0.92;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 3px 8px rgba(18, 35, 52, 0.04);
  margin-bottom: 14px;
}

.card h1,
.card h2 {
  margin-top: 0;
}

.narrow {
  max-width: 560px;
  margin: 14px auto;
}

.stack {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  font-weight: 600;
}

input,
button {
  font: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid #c7d4e2;
  background: #fff;
  border-radius: 9px;
  padding: 10px;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
}

.danger-btn {
  background: #8c2525;
}

.inline-form {
  display: inline;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.small {
  font-size: 12px;
}

.danger {
  color: var(--warn);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

pre.code {
  margin: 0;
  background: #0f1d2a;
  color: #f4f8ff;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.subsection {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.subsection h3 {
  margin: 0 0 8px 0;
}

.warn-banner {
  margin: 10px 0;
  border: 1px solid #f2c17c;
  background: #fff7eb;
  color: #7a4a07;
  border-radius: 8px;
  padding: 8px 10px;
}

.compact-form {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.compact-form select,
.compact-form input[type="text"] {
  font-size: 13px;
  padding: 8px;
}

.compact-form button {
  font-size: 13px;
  padding: 8px 10px;
}

.delete-form {
  margin-top: 8px;
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.time-zone-controls {
  display: flex;
  align-items: center;
}

.time-zone-select {
  min-width: 190px;
}

.filename-cell {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}

@media (max-width: 900px) {
  .toast-root {
    top: 66px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .grid {
    grid-template-columns: 1fr;
  }

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

  .filename-cell {
    max-width: 180px;
  }
}
