:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-muted: #eef3f8;
  --text: #17212f;
  --muted: #617085;
  --line: #d8e1ec;
  --accent: #047c89;
  --accent-strong: #035f69;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --success: #146c43;
  --success-bg: #edf8f2;
  --shadow: 0 18px 48px rgba(23, 33, 47, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(120deg, rgba(4, 124, 137, 0.10), rgba(120, 68, 177, 0.07)),
    var(--bg);
  color: var(--text);
}

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

.public-panel {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.public-panel.narrow {
  width: min(100%, 420px);
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #78a641);
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  margin-top: 16px;
  margin-bottom: 26px;
  font-size: 34px;
}

h2 {
  margin-bottom: 18px;
  font-size: 20px;
}

.form-stack,
.admin-form {
  display: grid;
  gap: 16px;
}

.admin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(4, 124, 137, 0.18);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 16px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

button.danger {
  background: var(--danger);
}

.quiet {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.intro-text {
  color: var(--muted);
  margin: -14px 0 22px;
}

.button-row {
  display: grid;
  gap: 10px;
}

.alert {
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 13px 14px;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid #ffd1cc;
  color: var(--danger);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid #cbeedd;
  color: var(--success);
}

.alert-warning {
  background: #fff8e6;
  border: 1px solid #f4dda1;
  color: #6f4d00;
}

.credential-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  margin-top: 12px;
}

code {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 3px 6px;
}

.admin-layout {
  display: grid;
  gap: 22px;
  width: min(100%, 1180px);
}

.admin-header,
.tool-panel,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 33, 47, 0.08);
  padding: 22px;
}

.admin-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.admin-header h1 {
  margin-bottom: 0;
}

.form-actions {
  align-self: end;
  display: flex;
  justify-content: flex-end;
}

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

.section-header {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  margin-bottom: 18px;
}

.section-header h2 {
  margin-bottom: 0;
}

.search-form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) max-content;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

td small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 9px;
}

.status-actif {
  background: var(--success-bg);
  color: var(--success);
}

.status-expire,
.status-revoque {
  background: var(--surface-muted);
  color: var(--muted);
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

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

@media (max-width: 760px) {
  .shell {
    align-items: start;
    padding: 14px;
  }

  .public-panel,
  .admin-header,
  .tool-panel,
  .table-panel {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .section-header,
  .search-form {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }
}
