﻿:root {
  --bg: #f4efe6;
  --bg-2: #e7efe6;
  --panel: #ffffff;
  --border: #1a1a1a;
  --muted: #5f5f5f;
  --accent: #2f6f54;
  --accent-2: #1c4d3c;
  --accent-weak: #dff0e7;
  --shadow: 8px 8px 0 #1a1a1a;
  --shadow-soft: 12px 12px 24px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --font-body: "Trebuchet MS", "Verdana", "Tahoma", sans-serif;
  --font-title: "Georgia", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(1200px 600px at 10% 10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, #f2e9dd, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, #f8f5f0 100%);
  color: #111;
}

.app {
  padding: 24px;
  min-height: 100vh;
  background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%),
    linear-gradient(225deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%),
    linear-gradient(45deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%),
    linear-gradient(315deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%);
  background-position: 12px 0, 12px 0, 0 0, 0 0;
  background-size: 24px 24px;
  background-repeat: repeat;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  border-radius: var(--radius);
  animation: rise 420ms ease-out;
}

.topbar h1 {
  margin: 0 0 6px 0;
  font-size: 26px;
  font-family: var(--font-title);
  letter-spacing: 0.3px;
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px 0;
}

.tab-btn {
  padding: 8px 14px;
  border: 2px solid var(--border);
  background: #fff;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 120ms ease, filter 120ms ease;
}

.tab-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.tab-btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

.controls select {
  padding: 8px 10px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 10px;
}

.status {
  margin: 16px 0;
  min-height: 20px;
  color: var(--muted);
}

.panel {
  margin-top: 10px;
}

.hidden {
  display: none;
}

.card-wide {
  background: var(--panel);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  animation: rise 420ms ease-out;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 10px 0 14px 0;
}

.admin-form input,
.admin-form select,
.admin-form button {
  padding: 8px 10px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 10px;
}

.pattern-input {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
}

.admin-form button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-color: #1f1f1f;
  transition: transform 120ms ease, filter 120ms ease;
}

.admin-form .secondary {
  background: #444;
}

.admin-form .danger {
  background: #b00020;
}

.actions button {
  padding: 6px 8px;
  border: 2px solid var(--border);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  margin-right: 6px;
  border-radius: 8px;
}

.actions .danger {
  background: #b00020;
}

.admin-form button:hover,
.actions button:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.admin-form button:active,
.actions button:active {
  transform: translateY(0);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.big-value {
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0 2px 0;
}

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

.swap-quick {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #c9c9c9;
}

.grid {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 12px;
  border-radius: var(--radius);
  animation: rise 420ms ease-out;
}
.grid table {
  min-width: max-content;
}

.schedule-cards {
  display: none;
  gap: 10px;
  margin-top: 12px;
}

.schedule-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.schedule-card__date {
  font-weight: 700;
  font-size: 14px;
}

.schedule-card__branch {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.schedule-card__list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.schedule-card__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed #c9c9c9;
  padding-bottom: 4px;
}

.schedule-card__row:last-child {
  border-bottom: none;
}

.schedule-card__role {
  font-weight: 700;
}

.schedule-card__name {
  color: #333;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
}

th,
td {
  border: 1px solid #333;
  padding: 6px;
  text-align: center;
  vertical-align: middle;
  background: #fff;
  min-width: 90px;
}

th.role-header,
td.role-cell {
  background: var(--accent-weak);
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 3;
  background-clip: padding-box;
}

th.role-header {
  z-index: 4;
}

th.date-header {
  background: #f1f1f1;
  font-weight: 600;
}

.card {
  background: var(--accent-2);
  color: #fff;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: grab;
  user-select: none;
}

.card.dragging {
  opacity: 0.6;
}

.drop-target {
  background: #fff8dc;
}

.error {
  color: #b00020;
}

.success {
  color: #0f5d2a;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar,
  .card-wide,
  .grid {
    animation: none;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .app {
    padding: 16px;
  }
  th.role-header,
  td.role-cell {
    position: static;
    z-index: auto;
  }
}
