:root {
  color-scheme: light;
  --bg: #f8f9fb;
  --panel: #ffffff;
  --surface-low: #f2f4f6;
  --surface: #edeef0;
  --text: #191c1e;
  --muted: #5f6660;
  --line: #e4e7eb;
  --line-strong: #c0c9bb;
  --primary: #00450d;
  --primary-hover: #205d23;
  --accent: #fdd400;
  --danger: #ba1a1a;
  --success: #0f7b24;
  --warning-bg: #fff8db;
  --warning-line: #ead276;
  --shadow: 0 1px 2px rgba(25, 28, 30, 0.04), 0 10px 26px rgba(25, 28, 30, 0.05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

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

a:hover { text-decoration: underline; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 max(20px, calc((100vw - 1200px) / 2 + 20px));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--primary);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.brand:hover { text-decoration: none; }
.brand-name { overflow-wrap: anywhere; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.nav form { margin: 0; }
.nav-user { white-space: nowrap; }

.container {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-panel h1,
.page-head h1 {
  margin: 0;
  color: var(--primary);
  font-size: 32px;
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: 0;
}

.auth-panel p,
.page-head p {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.form-row {
  display: grid;
  gap: 8px;
}

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

label {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.filter-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--surface-low);
  color: var(--text);
  font: inherit;
  outline: none;
}

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

input::placeholder,
textarea::placeholder { color: #8a918b; }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(253, 212, 0, 0.34);
  background: #ffffff;
}

.button,
button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 11px 18px;
  background: var(--primary);
  color: white;
  font: inherit;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

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

.button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button.secondary,
button.secondary {
  background: var(--surface-low);
  color: var(--primary);
  border-color: transparent;
}

.button.secondary:hover,
button.secondary:hover {
  background: var(--surface);
}

.button.secondary.active {
  background: var(--primary);
  color: white;
}

.button.danger,
button.danger {
  background: #ffffff;
  color: var(--danger);
  border-color: #f1b4ae;
}

.button.danger:hover,
button.danger:hover {
  background: #fff3f1;
}

.alert,
.notice {
  margin-top: 18px;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.45;
}

.alert {
  border: 1px solid var(--warning-line);
  background: var(--warning-bg);
  color: #6f5200;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid #abefc6;
  background: #ecfdf3;
  color: var(--success);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.filter-panel {
  margin-bottom: 32px;
}

.filter-panel .form-row {
  position: relative;
}

.filter-panel .form-row::before {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 18px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--muted);
  border-radius: 999px;
  pointer-events: none;
}

.filter-panel .form-row::after {
  content: "";
  position: absolute;
  left: 31px;
  bottom: 16px;
  width: 8px;
  height: 2px;
  background: var(--muted);
  border-radius: 999px;
  transform: rotate(45deg);
  pointer-events: none;
}

.filter-panel input {
  min-height: 50px;
  padding-left: 48px;
}

.filter-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
}

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

.section-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.resource-list {
  display: grid;
  gap: 16px;
}

.resource {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.resource:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(25, 28, 30, 0.08), 0 18px 42px rgba(25, 28, 30, 0.11);
}

.resource-rich {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
}

.plan-admin-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.sortable-resource {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  cursor: grab;
}

.sortable-resource.dragging {
  opacity: 0.55;
  border-color: var(--primary);
}

.resource-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  align-self: start;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font-size: 24px;
  font-weight: 850;
}

.resource-icon span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drag-handle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--muted);
  font-weight: 900;
  user-select: none;
}

.resource h2,
.resource h3 {
  margin: 0;
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0;
}

.resource h3 {
  font-size: 18px;
}

.resource p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  font-size: 14px;
}

.activity-table th,
.activity-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.activity-table th {
  color: var(--muted);
  background: var(--surface-low);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.activity-details {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.activity-day {
  padding: 0;
  overflow: hidden;
}

.activity-day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
}

.activity-day-summary::-webkit-details-marker {
  display: none;
}

.activity-day-summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.activity-day[open] .activity-day-summary {
  border-bottom: 1px solid var(--line);
}

.activity-day[open] .activity-day-summary::after {
  transform: rotate(225deg);
}

.activity-day-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.activity-day .table-wrap {
  border: 0;
  border-radius: 0;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: white;
}

.plan-list {
  display: grid;
  gap: 16px;
}

.plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.plan-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(25, 28, 30, 0.08), 0 18px 42px rgba(25, 28, 30, 0.11);
}

.plan-card summary {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
}

.plan-card summary::-webkit-details-marker {
  display: none;
}

.plan-card summary::after {
  content: "";
  width: 10px;
  height: 10px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.plan-card[open] summary::after {
  transform: rotate(225deg);
}

.plan-card summary strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.plan-card summary span span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.plan-pin {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--surface);
  font-size: 22px;
}

.plan-items {
  margin: 0;
  padding: 0 24px 24px 92px;
  color: var(--text);
  line-height: 1.55;
  list-style: none;
}

.plan-items li {
  padding: 8px 0;
}

.plan-check {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: start;
  gap: 10px;
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
}

.plan-check input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.plan-number {
  min-width: 24px;
  color: var(--muted);
  font-weight: 750;
}

.plan-text {
  transition: color 0.16s ease, text-decoration-color 0.16s ease;
}

.plan-check input:checked ~ .plan-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--line-strong);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.logo-preview {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface-low);
}

.logo-preview img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .nav {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .nav-user {
    width: 100%;
  }

  .container {
    width: min(100% - 28px, 1200px);
    padding-top: 28px;
  }

  .page-head,
  .section-head {
    display: grid;
    align-items: stretch;
  }

  .form-grid,
  .resource,
  .resource-rich,
  .sortable-resource,
  .plan-admin-item {
    grid-template-columns: 1fr;
  }

  .plan-card summary {
    align-items: flex-start;
    padding: 18px;
  }

  .plan-card summary strong {
    font-size: 19px;
  }

  .plan-items {
    padding: 0 18px 20px 48px;
  }

  .resource-icon,
  .drag-handle {
    width: 100%;
  }

  .actions {
    justify-content: stretch;
  }

  .actions .button,
  .actions button,
  .actions form {
    width: 100%;
  }
}
