:root {
  --bg: #f7f7f8;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1f6feb;
  --primary-fg: #ffffff;
  --danger: #b91c1c;
  --ok: #166534;
  --warn: #a16207;
  --card: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
}

.container { max-width: 1080px; margin: 1rem auto; padding: 0 1rem; }
.narrow { max-width: 560px; }
.center { text-align: center; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1rem;
  background: #111827; color: #f9fafb;
}
.topbar .brand { color: #f9fafb; font-weight: 600; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: .9rem; margin-left: auto; flex-wrap: wrap; }
.topbar nav a { color: #d1d5db; text-decoration: none; }
.topbar nav a:hover { color: #fff; }
.topbar nav .user { color: #93c5fd; }

.footer { text-align: center; color: var(--muted); padding: 2rem 0; }

h1, h2 { margin: .25rem 0 1rem; }
h2 { font-size: 1.1rem; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

label { display: block; margin: .6rem 0; }
label.inline { display: inline-flex; align-items: center; gap: .25rem; margin-right: 1rem; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}
textarea { resize: vertical; }

button, .button {
  display: inline-block;
  padding: .45rem .9rem;
  background: var(--primary); color: var(--primary-fg);
  border: 1px solid var(--primary); border-radius: 6px;
  text-decoration: none; cursor: pointer; font: inherit;
}
button:hover, .button:hover { filter: brightness(.95); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.danger { background: var(--danger); border-color: var(--danger); }
button.link {
  background: transparent; border: none; color: var(--primary);
  padding: 0; cursor: pointer; font: inherit; text-decoration: underline;
}
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: .5rem 1rem; margin: .75rem 0; }
legend { padding: 0 .35rem; color: var(--muted); }

.error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca;
         padding: .5rem .75rem; border-radius: 6px; margin: .5rem 0; }
.info { color: var(--ok); background: #f0fdf4; border: 1px solid #bbf7d0;
        padding: .5rem .75rem; border-radius: 6px; margin: .5rem 0; }
.muted { color: var(--muted); }

table.data {
  width: 100%; border-collapse: collapse; margin-top: .5rem;
}
table.data th, table.data td {
  padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left;
  vertical-align: top;
}
table.data th { background: #f3f4f6; font-size: 13px; color: #374151; }
table.data td.ua { font-size: 12px; max-width: 360px; word-break: break-word; }

code, .token {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px;
  background: #f3f4f6; padding: .15rem .4rem; border-radius: 4px;
}

.status {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.status-active { background: #dcfce7; color: #166534; }
.status-scheduled { background: #fef9c3; color: #854d0e; }
.status-expired { background: #f3f4f6; color: #374151; }
.status-revoked { background: #fee2e2; color: #b91c1c; }
.status-teacher_disabled { background: #fee2e2; color: #b91c1c; }
.status-max_access_reached { background: #fee2e2; color: #b91c1c; }

body.public { background: #fafafa; }
body.public h1 { margin-top: 1.5rem; }
body.public audio { width: 100%; margin: 1rem 0; }
.notes { background: #f3f4f6; padding: .75rem 1rem; border-radius: 6px; }
.footer-note { font-size: 12px; color: var(--muted); }
