/* Panoptyc Internal Tools — shared styles.
   Deliberately plain CSS: no build step, no framework to keep current. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #16191d;
  --text-dim: #5f6672;
  --accent: #2f5bd7;
  --accent-soft: #eef2fd;
  --good: #1a7f4b;
  --warn: #a1620a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 28, .05), 0 4px 16px rgba(16, 20, 28, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --border: #2b313a;
    --text: #e9ecf1;
    --text-dim: #98a1af;
    --accent: #7a9cf5;
    --accent-soft: #202839;
    --good: #5cc98d;
    --warn: #e0aa5a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* --- layout ------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -.01em;
}

.topbar .spacer { flex: 1; }

nav {
  display: flex;
  gap: 2px;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 11px;
  border-radius: 7px;
  white-space: nowrap;
}

nav a:hover { background: var(--accent-soft); color: var(--text); }

nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.who {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* --- cards -------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card > h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin: 0 0 16px;
}

/* --- headline figures --------------------------------------------------- */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.figure {
  background: var(--surface);
  padding: 18px 20px;
}

.figure .label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.figure .value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.figure.primary .value { color: var(--good); }

/* --- tables ------------------------------------------------------------- */

.scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}

td.num, th.num { text-align: right; }

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--accent-soft); }

tfoot td {
  font-weight: 650;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

/* --- controls ----------------------------------------------------------- */

select, button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 11px;
  cursor: pointer;
}

select:hover, button:hover { border-color: var(--accent); }

button.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
}

/* --- states ------------------------------------------------------------- */

.muted { color: var(--text-dim); }
.empty { color: var(--text-dim); padding: 8px 0; font-size: 14px; }

.error {
  background: #fdf0f0;
  border: 1px solid #f3c9c9;
  color: #8c2020;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  .error { background: #2c1b1b; border-color: #5a2b2b; color: #f0b4b4; }
}

/* --- portal home -------------------------------------------------------- */

.hero { margin: 8px 0 26px; }

.hero h2 {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.02em;
  margin: 0 0 6px;
}

.hero p { margin: 0; font-size: 15px; }

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.app-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s, transform .12s;
}

.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.app-card.disabled {
  opacity: .55;
  cursor: default;
}

.app-card.disabled:hover {
  border-color: var(--border);
  transform: none;
}

.app-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.app-body h3 {
  margin: 0 0 5px;
  font-size: 15.5px;
  font-weight: 620;
}

.app-body p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

.soon {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--accent-soft);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 6px;
}

/* --- view as user ------------------------------------------------------- */

#viewas {
  display: flex;
  align-items: center;
  gap: 7px;
}

#viewas select { min-width: auto; padding: 5px 8px; font-size: 13px; }

/* Loud on purpose: this is someone else's pay on screen. */
.viewas-banner {
  background: #fdf3d8;
  border: 1px solid #e6c97a;
  color: #6b4a05;
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.viewas-banner button.link { color: #6b4a05; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .viewas-banner { background: #35290d; border-color: #6b5520; color: #f0d089; }
  .viewas-banner button.link { color: #f0d089; }
}

/* --- status pills ------------------------------------------------------- */

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: capitalize;
}

.pill.submitted    { background: #e8eefc; color: #2a4b9b; }
.pill.under_review { background: #fdf0dc; color: #8a5a08; }
.pill.needs_info   { background: #fbe9e7; color: #9c3a1e; }
.pill.approved     { background: #e2f4e9; color: #14663c; }
.pill.denied       { background: #f2e6e6; color: #7d2b2b; }

@media (prefers-color-scheme: dark) {
  .pill.submitted    { background: #1e2942; color: #9dbaf5; }
  .pill.under_review { background: #34290f; color: #e5bd72; }
  .pill.needs_info   { background: #3a231c; color: #eda58c; }
  .pill.approved     { background: #17301f; color: #7fd7a3; }
  .pill.denied       { background: #331d1d; color: #e59b9b; }
}

/* --- filters + forms ---------------------------------------------------- */

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

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}

input[type=text], input[type=date], input[type=number], textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  min-width: 150px;
}

textarea { min-height: 84px; resize: vertical; width: 100%; }

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.field.wide { flex: 1 1 100%; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 8px 16px;
}

button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }

.row-actions { display: flex; gap: 8px; }

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* --- pagination --------------------------------------------------------- */

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
}

/* --- detail / history --------------------------------------------------- */

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }

.timeline li {
  padding: 9px 0 9px 16px;
  border-left: 2px solid var(--border);
  position: relative;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline .when { color: var(--text-dim); font-size: 12.5px; }

.truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- login -------------------------------------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login h1 {
  font-size: 20px;
  font-weight: 650;
  margin: 0 0 6px;
  letter-spacing: -.02em;
}

.login p {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 26px;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  font-weight: 550;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.login .note {
  margin: 22px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* Zoho sits below Google on the login card; a little separation, no colour claim. */
.btn-zoho { margin-top: 10px; }
