:root {
  --bg: #f4f1e8;
  --panel: #fffdf8;
  --line: #d9d2c3;
  --text: #1d2730;
  --muted: #4e5f67;
  --accent: #0f766e;
  --accent-dark: #0a5450;
  --danger: #a32121;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: #ffffff;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
}

.app-loader-card {
  min-width: min(320px, 90vw);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 1rem;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
}

.loader-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #d7d7d7;
  border-top-color: #000000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.layout {
  width: min(1200px, 95vw);
  margin: 1rem auto 2rem;
  display: grid;
  gap: 0.95rem;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 10px 28px rgba(31, 50, 58, 0.09);
}

.hero {
  position: sticky;
  top: 0.4rem;
  z-index: 3;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 0.8rem;
  align-items: center;
  background: #ffffff;
}

.hero-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-icon-xl {
  width: 100%;
  height: auto;
  max-height: 150px;
  object-fit: contain;
  align-self: center;
  justify-self: center;
}

.top-nav {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.hero .top-nav {
  margin-bottom: 0;
}

.hero p {
  margin-bottom: 0.35rem;
}

.hero h1 {
  margin-top: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

.nav-btn {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--accent-dark);
}

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

.view {
  animation: reveal 220ms ease-out both;
}

.split-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.9rem;
}

.workspace-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

h1,
h2,
h3 {
  margin: 0 0 0.7rem;
}

p {
  margin: 0.2rem 0;
  color: var(--muted);
}

.sync-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.sync-settings {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

.sync-settings-actions {
  display: flex;
  gap: 0.55rem;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: end;
}

button,
.file-upload {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  padding: 0.6rem 0.9rem;
  font-weight: 700;
  font: inherit;
}

button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--accent-dark);
}

.file-upload {
  position: relative;
  overflow: hidden;
  display: inline-flex;
}

.file-upload input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.status {
  margin-top: 0.6rem;
  min-height: 1.2rem;
}

.filters {
  grid-column: 1 / -1;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
}

label {
  display: block;
  font-size: 0.93rem;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 0.3rem;
  border: 1px solid var(--line);
  background: #f8f6ef;
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  font: inherit;
}

.list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.day-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f4ea;
  padding: 0.7rem;
}

.month-divider {
  margin-top: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: #e9e9e9;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #000000;
}

.day-date {
  font-weight: 800;
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--line);
}

.day-course-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.day-course-row {
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 10px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: center;
}

.drawing-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.45rem;
}

.day-course-row button {
  width: auto;
  padding: 0.45rem 0.6rem;
}

.badge-new {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  background: #d45500;
}

.badge-model {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.07rem 0.42rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  background: #0d6efd;
}

.badge-confirmed {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.07rem 0.42rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  background: #188038;
}

.badge-pending {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.07rem 0.42rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #111111;
  background: #ffd54f;
}

.row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f4ea;
  padding: 0.65rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr auto;
}

.row-title {
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actions button {
  width: auto;
  padding: 0.45rem 0.6rem;
  min-height: 38px;
}

.danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.confirm-toggle-on {
  background: #188038;
  color: #ffffff;
  border: 1px solid #188038;
  min-width: 126px;
  text-align: center;
}

.confirm-toggle-off {
  background: #ffd54f;
  color: #111111;
  border: 1px solid #ffd54f;
  min-width: 126px;
  text-align: center;
}

.lesson-form {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
}

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

.hidden {
  display: none;
}

.conflict {
  border-color: #d97070;
  background: #fff1f1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(14, 20, 28, 0.48);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(760px, 95vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.modal-card.large {
  width: min(980px, 96vw);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

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

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

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .brand-icon-xl {
    max-height: 95px;
    width: auto;
    margin: 0 auto;
  }
  .split-grid {
    grid-template-columns: 1fr;
  }
  .sync-settings {
    grid-template-columns: 1fr;
  }
  .inline-form {
    grid-template-columns: 1fr;
  }
}
