:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #15202b;
  --muted: #657384;
  --line: #d9e0e7;
  --accent: #0f766e;
  --accent-strong: #0b5e58;
  --blue: #2457a6;
  --danger: #b42318;
  --warning: #9a5b00;
  --success: #067647;
  --shadow: 0 14px 34px rgba(24, 39, 75, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(18px, 4vw, 56px) 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-header h1,
.focus-panel h2,
.linkedin-panel h2,
.course-title,
.modal h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: 30px;
  line-height: 1.18;
}

.header-copy {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.header-actions,
.toolbar-actions,
.timer-actions,
.linkedin-actions,
.course-actions,
.modal-actions,
.certificate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-actions {
  max-width: 430px;
}

.toolbar-actions-header {
  flex: 1 0 100%;
  display: grid;
  gap: 4px;
  padding: 0 0 4px;
}

.toolbar-actions-header strong {
  font-size: 15px;
}

.toolbar-actions-header span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: grid;
  gap: 18px;
}

.toolbar,
.focus-panel,
.linkedin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  gap: 12px;
  padding: 16px;
  align-items: center;
}

.metric {
  min-height: 64px;
  padding: 12px;
  background: var(--surface-muted);
  border-radius: 6px;
}

.metric-label,
.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric strong {
  font-size: 24px;
}

.focus-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.focus-panel h2,
.linkedin-panel h2 {
  font-size: 20px;
}

.focus-panel p,
.linkedin-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.timer-clock {
  min-width: 122px;
  padding: 12px 16px;
  text-align: center;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 28px;
  font-weight: 700;
}

.courses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.course-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.course-title {
  font-size: 20px;
  line-height: 1.3;
}

.course-meta,
.course-description,
.block-status,
.note-list {
  color: var(--muted);
  line-height: 1.55;
}

.course-meta {
  margin-top: 8px;
  font-size: 14px;
}

.status-pill {
  flex: 0 0 auto;
  height: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf7f5;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 160ms ease;
}

.block-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.block-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.block-item.done {
  background: #f0f9f6;
  border-color: #b8e4d2;
}

.block-check {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.block-item.done .block-check {
  background: var(--success);
  color: #ffffff;
}

.notes {
  display: grid;
  gap: 8px;
}

.note-list {
  max-height: 108px;
  overflow: auto;
  padding-left: 18px;
  margin: 0;
}

.certificate-form {
  display: none;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.certificate-form.visible {
  display: grid;
}

.certificate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  background: #ffffff;
}

textarea {
  resize: vertical;
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.button {
  min-height: 38px;
  padding: 10px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  background: #ffffff;
  color: var(--blue);
  border-color: #b8c7df;
}

.button.ghost {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--line);
}

.button.danger {
  background: #fff4f2;
  color: var(--danger);
  border-color: #f2b8b5;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button {
  width: 34px;
  height: 34px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 22px;
}

.linkedin-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.output {
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 6px;
  background: #111827;
  color: #f9fafb;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.modal {
  width: min(560px, calc(100% - 28px));
  border: 0;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.22);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(18px);
  min-width: min(420px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .app-header,
  .focus-panel {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .toolbar,
  .courses,
  .certificate-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions,
  .header-actions,
  .linkedin-actions {
    width: 100%;
  }

  .button {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .layout {
    width: min(100% - 20px, 1180px);
    margin-top: 14px;
  }

  .app-header {
    padding: 24px 14px 18px;
  }

  .app-header h1 {
    font-size: 24px;
  }

  .course-top {
    display: grid;
  }

  .header-actions .button,
  .toolbar-actions .button,
  .toolbar-actions label,
  .course-actions .button,
  .linkedin-actions .button {
    width: 100%;
  }
}
