:root {
  --green: #1f7a4d;
  --green-dark: #155c39;
  --green-light: #e8f3ec;
  --ink: #1c2522;
  --muted: #667;
  --line: #e2e6e4;
  --bg: #f6f8f7;
  --warn-bg: #fff7e6;
  --warn-line: #f0d090;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .leaf { font-size: 26px; }
.brand strong { display: block; font-size: 16px; }
.brand .sub { color: var(--muted); font-size: 13px; }
nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
nav a { color: var(--green-dark); text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav .who { color: var(--muted); }

main { max-width: 1180px; margin: 28px auto; padding: 0 20px; }

footer {
  max-width: 1180px;
  margin: 10px auto 40px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 22px;
}
h1 { margin: 0 0 6px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 18px; }
.muted { color: var(--muted); }
code {
  background: var(--green-light);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
}

.btn {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 11px 20px;
  font-size: 15px;
  cursor: pointer;
}
.btn:hover { background: var(--green-dark); }
.btn-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 12px;
}

label { display: block; margin: 14px 0; font-size: 14px; font-weight: 600; }
input[type=text], input[type=password], select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 400;
  background: #fff;
}
select { max-width: 420px; }
.inline-check { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.inline-check input { width: auto; }

.login-card { max-width: 380px; margin: 40px auto; }
.muted.small { font-size: 12px; margin-top: 14px; }

.btn-ms {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #2f2f2f;
  color: #fff;
  text-decoration: none;
  border-radius: 9px;
  padding: 12px 18px;
  font-size: 15px;
  margin-top: 8px;
}
.btn-ms:hover { background: #1f1f1f; }
.ms-logo {
  width: 18px;
  height: 18px;
  display: inline-block;
  background:
    linear-gradient(#f25022 0 0) 0 0 / 8px 8px no-repeat,
    linear-gradient(#7fba00 0 0) 10px 0 / 8px 8px no-repeat,
    linear-gradient(#00a4ef 0 0) 0 10px / 8px 8px no-repeat,
    linear-gradient(#ffb900 0 0) 10px 10px / 8px 8px no-repeat;
}

.flash {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 9px;
  padding: 10px 16px;
  margin-bottom: 20px;
}
.flash p { margin: 4px 0; }

/* Upload */
.upload-form { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.file-drop {
  flex: 1;
  min-width: 260px;
  border: 2px dashed var(--green);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: var(--green-light);
  font-weight: 400;
  margin: 0;
}
.file-drop input { display: none; }
.file-drop .fname { color: var(--green-dark); }

.sheet-list { width: 100%; border-collapse: collapse; margin: 8px 0 18px; }
.sheet-list th, .sheet-list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sheet-list th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.sheet-list tr.dim { color: #aab; }

/* Results */
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.stat.highlight { background: var(--green-light); border-color: #bcdcc8; }
.stat-num { display: block; font-size: 28px; font-weight: 700; color: var(--green-dark); }
.stat-label { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat-sub { display: block; font-size: 12px; color: var(--muted); }

.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.card.warn ul { margin: 6px 0; }

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data thead th { position: sticky; top: 0; background: #fff; color: var(--muted); font-size: 11px; text-transform: uppercase; vertical-align: bottom; }
table.data th.num, table.data td.num { text-align: right; }
.th-sub { font-weight: 400; text-transform: none; color: #9aa; }
table.data td.strong, table.data .strong { font-weight: 700; color: var(--green-dark); }
table.data tbody tr:hover { background: var(--green-light); }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--green); background: #fafcfb; }
table.data tr.rowerr { background: #fdeeee; }

.method ul { margin: 6px 0; padding-left: 20px; }
.method li { margin: 5px 0; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #eef1f0;
  color: #445;
}
.tag-process { background: var(--green-light); color: var(--green-dark); }
.tag-login { background: #e6f0fb; color: #1b5e9b; }
.tag-logout { background: #eef1f0; color: #556; }
.tag-login_failed, .tag-login_denied { background: #fdeeee; color: #a33; }
