:root {
  --bg: #0b1220;
  --bg-soft: #0f1826;
  --card: #131c2b;
  --border: #223049;
  --border-soft: #1b2536;
  --text: #e6edf6;
  --muted: #8496b0;
  --accent: #4fd1c5;
  --accent-dim: rgba(79, 209, 197, 0.12);
  --coral: #f4675a;
  --coral-hover: #ff7a6c;
  --danger: #ef6c6c;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

/* Sem isto o atributo [hidden] perde para os `display: flex` abaixo. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(120% 80% at 50% 0%, #101c30 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 8px 4px 0;
}

.app-title {
  flex: 1 1 auto;
  min-width: 0;
}

.logout-btn {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 4px 2px;
  color: var(--muted);
}

.logout-btn:hover {
  color: var(--text);
}

.login-view {
  justify-content: center;
  min-height: 100vh;
  max-width: 400px;
}

.app-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4fd1c5, #2f9e94);
  color: #08131a;
}

.app-logo svg {
  width: 24px;
  height: 24px;
}

.app-header h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-header p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font: inherit;
  padding: 13px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  padding-right: 40px;
  cursor: pointer;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder {
  color: #5d6f8a;
}

.select-wrap {
  position: relative;
}

.chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Painel de alunos */
.students-panel {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(15, 24, 38, 0.6);
}

.students-add {
  display: flex;
  gap: 8px;
}

.students-add button {
  flex: 0 0 auto;
  background: var(--accent-dim);
  border: 1px solid rgba(79, 209, 197, 0.35);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 11px;
  cursor: pointer;
}

.students-add button:hover {
  background: rgba(79, 209, 197, 0.2);
}

.students-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 200px;
  overflow-y: auto;
}

.students-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 4px 7px 8px;
  border-radius: 8px;
  font-size: 14px;
}

.students-list li + li {
  border-top: 1px solid var(--border-soft);
}

.students-list .empty {
  color: var(--muted);
  font-size: 13px;
  justify-content: flex-start;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 7px;
}

.remove-btn:hover {
  color: var(--danger);
  background: rgba(239, 108, 108, 0.1);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

/* Resumo do plano */
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(79, 209, 197, 0.07);
  border: 1px solid rgba(79, 209, 197, 0.16);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  padding: 13px 15px;
}

.summary-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.summary-left strong {
  color: var(--accent);
  font-size: 15px;
}

.summary-left span,
.summary-right span {
  font-size: 12px;
  color: var(--muted);
}

.summary-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  white-space: nowrap;
}

.summary-right strong {
  font-size: 19px;
  font-weight: 700;
}

/* Botoes */
.primary-btn {
  width: 100%;
  border: none;
  border-radius: 11px;
  background: var(--coral);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 15px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.primary-btn:hover:not(:disabled) {
  background: var(--coral-hover);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.form-error,
.students-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

/* Mensagem */
.message-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.message-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(79, 209, 197, 0.35);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 9px;
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(79, 209, 197, 0.2);
}

.copy-btn svg {
  width: 15px;
  height: 15px;
}

.message-body {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d7e2f0;
}

@media (max-width: 400px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
