/* DRG Apps portal — matches Daily Numbers design language */

:root {
  --paper: #f7f5f0;
  --paper-2: #efece4;
  --ink: #1a1a1a;
  --ink-2: #4a4a4a;
  --muted: #8a8a8a;
  --accent: #1d6a4a;
  --accent-2: #154f37;
  --danger: #b3261e;
  --success: #1d6a4a;
  --line: #d9d4c8;
  --shadow: 0 1px 0 rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.05);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.mono { font-family: "DM Mono", ui-monospace, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- top bar ---------- */
.topbar {
  background: #000;
  color: #fff;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: relative;
}
.logo {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}
.logo img {
  height: 42px;
  width: auto;
  display: block;
}
.topnav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topnav a {
  color: #fff;
  text-decoration: none;
  opacity: 0.8;
}
.topnav a:hover { opacity: 1; }
.topnav .who {
  color: #aaa;
  font-family: "DM Mono", monospace;
  font-size: 13px;
  white-space: nowrap;
}
.logout-form { margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  opacity: 0.8;
}
.link-btn:hover { opacity: 1; }

/* ---------- layout ---------- */
.container {
  max-width: 980px;
  margin: 40px auto;
  padding: 0 24px;
}

.page-title {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 36px;
  margin: 0 0 24px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-head .page-title { margin: 0; }

/* ---------- flashes ---------- */
.flashes {
  max-width: 980px;
  margin: 16px auto 0;
  padding: 0 24px;
}
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 14px;
}
.flash-success { background: #e3f0ea; color: var(--accent-2); border: 1px solid #b5dac6; }
.flash-error   { background: #fbe6e4; color: var(--danger);   border: 1px solid #f0b8b4; }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--paper-2); }
button.primary, .primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover, .primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

/* ---------- login ---------- */
.login-card {
  max-width: 380px;
  margin: 80px auto;
  background: #fff;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card .login-logo {
  display: block;
  width: 160px;
  height: auto;
  margin: 0 auto 20px;
}
.login-card h1 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 32px;
  margin: 0 0 4px;
}
.login-card p { margin: 0 0 24px; }
.login-card form { text-align: left; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-card {
  background: #fff;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 560px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  color: var(--ink);
}
input[type="text"], input[type="password"], select {
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* Password field with show/hide eye toggle */
.password-wrapper { position: relative; display: block; }
.password-wrapper input { width: 100%; padding-right: 40px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  border-radius: 6px;
}
.pw-toggle:hover { color: var(--ink); background: var(--paper-2); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

/* ---------- dashboard tiles ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.04), 0 8px 22px rgba(0,0,0,0.07);
}
.tile-icon {
  font-family: "Instrument Serif", serif;
  font-size: 36px;
  color: var(--accent);
  line-height: 1;
}
.tile-name {
  font-weight: 500;
  font-size: 17px;
}
.tile-desc {
  color: var(--muted);
  font-size: 13px;
}
.tile-placeholder {
  background: var(--paper-2);
  border-style: dashed;
  cursor: default;
  opacity: 0.65;
}
.tile-placeholder:hover { transform: none; box-shadow: var(--shadow); }

/* ---------- admin table ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
table.data th {
  background: var(--paper-2);
  font-weight: 500;
  color: var(--ink-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
table.data tr:last-child td { border-bottom: none; }
table.data a { color: var(--accent-2); text-decoration: none; font-weight: 500; }
table.data a:hover { text-decoration: underline; }
.row-disabled td { opacity: 0.5; }
form.inline { display: inline; margin: 0; }

/* ---------- error page ---------- */
.error-card {
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
}
.error-card h1 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 72px;
  margin: 0;
  color: var(--accent);
}
