:root {
  --navy: #0B1F3A;
  --navy-2: #13305A;
  --blue: #1E4E8C;
  --blue-2: #2F6FD0;
  --blue-light: #E8F0FB;
  --bg: #F3F6FA;
  --card: #FFFFFF;
  --text: #0B1F3A;
  --muted: #4A5B75;
  --line: #CCD6E4;
  --green: #137333;
  --green-bg: #E3F4E8;
  --orange: #A15C00;
  --orange-bg: #FFF1DC;
  --red: #B3261E;
  --red-bg: #FCE8E6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.4;
}
a { color: var(--blue-2); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 0 0 .8rem; font-weight: 800; }
h2 { font-size: 1.3rem; margin: 1.2rem 0 .6rem; font-weight: 800; }
.boot { padding: 3rem; text-align: center; font-size: 1.3rem; }

/* ---------- Πάνω μπάρα ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 800; font-size: 1.25rem; white-space: nowrap; }
.brand img { width: 38px; height: 38px; }
.brand small { display: block; font-size: .65rem; font-weight: 500; color: #9DBBE8; letter-spacing: .03em; }
.nav { display: flex; gap: .3rem; }
.nav a { color: #DCE7F7; padding: .5rem .8rem; border-radius: 8px; font-size: 1rem; }
.nav a.active, .nav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.search-top { flex: 1; max-width: 520px; margin-left: auto; }
.search-top input {
  width: 100%; padding: .6rem .9rem; border-radius: 8px; border: 0; font-size: 1rem; font-weight: 600;
}
.user-menu { color: #DCE7F7; font-size: .9rem; white-space: nowrap; }
.user-menu a { color: #fff; }

main { max-width: 1400px; margin: 0 auto; padding: 1.4rem 1.2rem 6rem; }

/* ---------- Κουμπιά & φόρμες ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 2px solid var(--blue); background: var(--blue);
  color: #fff; padding: .55rem 1.1rem; border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer;
  font-family: inherit; text-decoration: none !important;
}
.btn:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--blue); }
.btn.secondary:hover { background: var(--blue-light); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }
input, select, textarea {
  font-family: inherit; font-size: 1rem; padding: .55rem .7rem; border: 2px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-2); }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }
.toolbar input.q { min-width: 280px; flex: 1; font-weight: 600; }
label { display: block; font-weight: 700; margin-bottom: .25rem; font-size: .95rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem 1.2rem; }
.form-grid .full { grid-column: 1 / -1; }
.req::after { content: " *"; color: var(--red); }

/* ---------- Κάρτες / πίνακες ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 1px 3px rgba(11,31,58,.12); margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.tile { background: var(--card); border-radius: var(--radius); padding: 1rem 1.2rem; border-left: 6px solid var(--blue); box-shadow: 0 1px 3px rgba(11,31,58,.12); }
.tile .n { font-size: 2.3rem; font-weight: 800; line-height: 1.1; }
.tile .l { color: var(--muted); font-weight: 700; }
.tile.warn { border-left-color: var(--orange); }
.tile.bad { border-left-color: var(--red); }
.tile.ok { border-left-color: var(--green); }

table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(11,31,58,.12); }
table.list th { background: var(--navy); color: #fff; text-align: left; padding: .7rem .8rem; font-size: .95rem; white-space: nowrap; }
table.list td { padding: .65rem .8rem; border-top: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--blue-light); }
td.pn, .pn { font-family: Consolas, "Courier New", monospace; font-weight: 800; font-size: 1.05rem; }
td.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.count { color: var(--muted); font-weight: 700; margin: -.4rem 0 .8rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); font-size: 1.1rem; background: #fff; border-radius: var(--radius); }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-weight: 800; font-size: .85rem; white-space: nowrap; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--orange-bg); color: var(--orange); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.info { background: var(--blue-light); color: var(--blue); }
.badge.itar { background: var(--red); color: #fff; }

/* ---------- Λεπτομέρειες ---------- */
.detail-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.detail-head h1 { margin: 0; }
.detail-head .sub { color: var(--muted); font-weight: 600; margin-top: .3rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1.4rem; }
.kv div b { display: block; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.kv div span { font-size: 1.1rem; font-weight: 700; word-break: break-word; }
.tabs { display: flex; gap: .2rem; border-bottom: 3px solid var(--navy); margin: 1rem 0; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; padding: .7rem 1rem; font-size: 1rem; font-weight: 700; color: var(--muted);
  cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap; font-family: inherit;
}
.tabs button.active { background: var(--navy); color: #fff; }
.tabs button .c { background: var(--blue-light); color: var(--blue); border-radius: 999px; padding: 0 .45rem; margin-left: .3rem; font-size: .8rem; }
.back { display: inline-block; margin-bottom: .6rem; }
.pre { white-space: pre-wrap; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(11,31,58,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 3vh 1rem; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 820px; padding: 1.4rem; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 60; }
#toast div { background: var(--navy); color: #fff; padding: .8rem 1.4rem; border-radius: 10px; font-weight: 700; margin-top: .4rem; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
#toast div.error { background: var(--red); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy), var(--blue)); padding: 1rem; }
.login { background: #fff; border-radius: 14px; padding: 2rem; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login .brand { color: var(--navy); margin-bottom: 1.4rem; font-size: 1.5rem; }
.login .brand small { color: var(--blue); }
.login form > div { margin-bottom: 1rem; }
.login .btn { width: 100%; justify-content: center; padding: .8rem; font-size: 1.1rem; }
.login .err { color: var(--red); font-weight: 700; min-height: 1.4em; }

/* ---------- Εισαγωγή ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.map-grid .col { background: var(--bg); padding: .6rem; border-radius: 8px; }
.map-grid .col b { display: block; margin-bottom: .3rem; word-break: break-word; }
.scroll-x { overflow-x: auto; }
table.preview { border-collapse: collapse; font-size: .85rem; }
table.preview td, table.preview th { border: 1px solid var(--line); padding: .3rem .5rem; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.preview th { background: var(--blue-light); }

.bottom-nav { display: none; }

/* Μεσαίες οθόνες: η αναζήτηση πάει σε δεύτερη γραμμή */
@media (max-width: 1280px) {
  .topbar { flex-wrap: wrap; row-gap: .5rem; }
  .search-top { order: 3; flex-basis: 100%; max-width: none; }
  .user-menu { margin-left: auto; }
}

/* ---------- Κινητό ---------- */
@media (max-width: 860px) {
  html { font-size: 17px; }
  .topbar { flex-wrap: wrap; padding: .5rem .8rem; gap: .5rem; }
  .nav { display: none; }
  .search-top { order: 3; flex-basis: 100%; max-width: none; }
  .user-menu { margin-left: auto; }
  main { padding: 1rem .8rem 6rem; }
  h1 { font-size: 1.45rem; }
  .toolbar input, .toolbar select, .toolbar input.q { min-width: 0; width: 100%; }
  .toolbar .btn { flex: 1; justify-content: center; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--navy);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { flex: 1; text-align: center; color: #BFD3F0; padding: .55rem .2rem; font-size: .8rem; }
  .bottom-nav a .i { display: block; font-size: 1.35rem; }
  .bottom-nav a.active { color: #fff; background: var(--navy-2); }
  /* Οι πίνακες γίνονται κάρτες */
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list thead { display: none; }
  table.list { background: transparent; box-shadow: none; }
  table.list tr { background: #fff; border-radius: var(--radius); margin-bottom: .7rem; box-shadow: 0 1px 3px rgba(11,31,58,.15); padding: .4rem 0; }
  table.list td { border: 0; padding: .25rem .9rem; display: flex; gap: .6rem; }
  table.list td::before { content: attr(data-l); font-weight: 700; color: var(--muted); min-width: 38%; font-size: .85rem; padding-top: .1rem; }
  table.list td:empty { display: none; }
  table.list td.num { text-align: left; }
  .modal { padding: 1rem; }
}
@media print {
  .topbar, .bottom-nav, .toolbar, .tabs, .btn { display: none !important; }
  body { background: #fff; }
}
