:root {
  --bg: #f4f8fb;
  --card: #ffffff;
  --text: #102a43;
  --muted: #486581;
  --accent: #0a6dff;
  --warn: #f08c00;
  --danger: #c92a2a;
  --line: #d9e2ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 5% 5%, #d8ecff 0%, var(--bg) 35%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { margin: 0; }
.topbar p { margin: 4px 0 0; color: var(--muted); }

.session {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#currentIdentity {
  color: var(--muted);
  font-size: 0.92rem;
}

.login-view {
  min-height: calc(100vh - 86px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  width: min(520px, 100%);
}

.login-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  padding: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(16, 42, 67, 0.06);
}

.panel h2 { margin-top: 0; }

label { display: block; margin-bottom: 8px; color: var(--muted); }
label input[type="checkbox"] { margin-right: 6px; }

input,
select,
button {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover { opacity: 0.9; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#selectedFileName {
  color: var(--muted);
  font-size: 0.93rem;
  overflow-wrap: anywhere;
}

.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;
}

.status-line {
  color: var(--muted);
  min-height: 20px;
}

pre {
  background: #0b1f33;
  color: #d7e8ff;
  padding: 10px;
  border-radius: 10px;
  overflow: auto;
  max-height: 220px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 4px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.near { color: var(--warn); font-weight: 700; }
.overdue { color: var(--danger); font-weight: 700; }

#timeline {
  margin: 0;
  padding-left: 18px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.inline-form label { margin: 0; }

.inline-form label input[type="text"],
.inline-form label input[type="email"] {
  width: 100%;
  min-width: 180px;
}

#reviewMeta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

#reviewForm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

#reviewForm small { color: var(--muted); }
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button,
.row-actions .link-button {
  padding: 6px 8px;
}

.link-button {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .session {
    width: 100%;
    justify-content: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
  }
}
