/* EGM back-office. One stylesheet, no build step. */

@font-face {
  font-family: "Noto Sans Ethiopic";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/noto-sans-ethiopic-ethiopic-400-normal.woff2") format("woff2");
  unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F, U+1E7E0-1E7FF;
}
@font-face {
  font-family: "Noto Sans Ethiopic";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/noto-sans-ethiopic-ethiopic-600-normal.woff2") format("woff2");
  unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F, U+1E7E0-1E7FF;
}
@font-face {
  font-family: "Noto Sans Ethiopic";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/noto-sans-ethiopic-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Ethiopic";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/noto-sans-ethiopic-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --text: #1d2420;
  --muted: #5d6862;
  --line: #d9dfdb;
  --accent: #1f6f43;
  --accent-text: #ffffff;
  --danger: #a3281f;
  --warn-bg: #fff6dc;
  --ok-bg: #e5f4ea;
  --err-bg: #fbe9e7;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Noto Sans Ethiopic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
header.top .bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}
header.top .brand { font-weight: 600; text-decoration: none; color: var(--text); }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; }
header.top nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
header.top nav a.on { color: var(--text); border-bottom-color: var(--accent); }
header.top .who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

h1 { font-size: 24px; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 18px; margin: 28px 0 10px; font-weight: 600; }
.sub { color: var(--muted); font-size: 14px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.toolbar .grow { flex: 1; min-width: 200px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* Tables scroll sideways on a phone instead of squashing. */
.panel > h2:first-child { margin-top: 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; white-space: nowrap; }
td.code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
tr.inactive td { color: var(--muted); }
.indent { padding-left: 22px; }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[readonly] { background: var(--bg); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { margin-bottom: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks label { font-weight: 400; display: flex; gap: 6px; align-items: center; }

button, .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button.secondary, .button.secondary { background: var(--surface); color: var(--accent); }
button.small { padding: 3px 9px; font-size: 13px; }
button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.badge { white-space: nowrap; display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--ok-bg); color: var(--accent); }
.badge.off { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.msg { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--line); }
.msg.ok { background: var(--ok-bg); }
.msg.err { background: var(--err-bg); border-color: #efc4be; }
.msg.warn { background: var(--warn-bg); }
.msg ul { margin: 6px 0 0; padding-left: 20px; }

.icon-thumb { width: 40px; height: 40px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.icon-large { width: 96px; height: 96px; }
.icon-none {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 9px;
  line-height: 1.15;
  color: var(--muted);
  border-style: dashed;
}

.changes { margin: 0; padding-left: 18px; font-size: 14px; }
.changes .from { color: var(--danger); text-decoration: line-through; }
.changes .to { color: var(--accent); }

.pager { margin-top: 12px; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login h1 { text-align: center; }

.show-sm { display: none; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  /* Brand and account on one row, the nav as its own row that scrolls
     sideways instead of stacking into a narrow column. */
  header.top .bar { padding: 8px 16px 0; gap: 4px 12px; }
  header.top .brand { flex: 1; }
  header.top nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 18px; padding-bottom: 2px; }
  header.top nav a { white-space: nowrap; }
  .show-sm { display: block; }
  h1 { font-size: 21px; }
  main { padding-top: 14px; }
  th, td { padding: 7px 8px; }
  .hide-sm { display: none; }
}
