:root {
  --green: #1f7a4d;
  --green-dark: #145b38;
  --red: #a33a31;
  --ink: #17221c;
  --muted: #66736c;
  --line: #dfe8e2;
  --soft: #f4f8f5;
  --warn: #fff7db;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
}
.brand {
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
  font-size: 18px;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px;
}
.page-title {
  margin-bottom: 18px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
.page-title p, .muted { color: var(--muted); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.device-card, .panel, .status-hero, .login-panel, .empty, .warning-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(20, 91, 56, 0.05);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}
.online { color: #0e6d3b; background: #e4f5ea; }
.offline { color: #8a2d2d; background: #fbe9e7; }

.metric-row, .status-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.metric-row div, .status-hero div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--soft);
}
label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
strong {
  overflow-wrap: anywhere;
}
.schedule-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.schedule-strip span {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
button, .details-link {
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 13px;
  text-decoration: none;
}
button:hover, .details-link:hover { background: var(--green-dark); }
button:disabled {
  background: #a9b5ae;
  cursor: not-allowed;
}
.danger { background: var(--red); }
.primary { background: var(--green); }
.full { width: 100%; }
.link-button {
  background: transparent;
  color: var(--green-dark);
  min-height: 0;
  padding: 0;
}
.details-link { margin-top: 12px; }

.panel, .status-hero, .warning-block {
  margin-bottom: 14px;
}
.warning, .warning-block {
  background: var(--warn);
  border-color: #ead27b;
  color: #705200;
}
.warning {
  border: 1px solid #ead27b;
  border-radius: 10px;
  margin-top: 10px;
  padding: 9px;
}
.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.message {
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.message.error { background: #fff0ef; border-color: #e4aaa5; }
.message.success { background: #e7f7ed; border-color: #a8d7b8; }
.message.info { background: #edf5ff; border-color: #b6d4f2; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 6px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; }

.schedule-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
input {
  width: 100%;
  border: 1px solid #bdcbc3;
  border-radius: 10px;
  font: inherit;
  min-height: 42px;
  padding: 9px 10px;
}
.login-panel {
  max-width: 380px;
  margin: 48px auto;
}
.login-panel form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.trusted-device-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 8px;
}
.account-panel .trusted-device-option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--green);
  cursor: pointer;
}
.trusted-device-option label {
  margin: 0;
  color: #294c31;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}
.trusted-device-option:focus-within {
  border-radius: 6px;
  outline: 3px solid rgba(39, 121, 71, .18);
  outline-offset: 3px;
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .page { padding: 14px; }
  h1 { font-size: 24px; }
  .actions form, .actions button { width: 100%; }
}

.field-header { margin-bottom: 12px; }
.field-header h1 { margin-bottom: 4px; }
.field-header p { margin: 0; color: var(--muted); }
.field-switcher {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}
.field-switcher label { font-weight: 700; }
.field-switcher select { flex: 1; min-width: 0; min-height: 44px; border: 1px solid #9bad9f; border-radius: 10px; padding: 8px; font: inherit; }
.all-fields-link, .button-link, .btn-primary { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.all-fields-link { color: var(--green-dark); font-weight: 700; white-space: nowrap; }
.field-capabilities { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.field-capabilities span { padding: 7px 10px; border-radius: 999px; background: var(--soft); }
.customer-shell { min-height: 100vh; background: #f7faf8; }
.customer-topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 14px;
  min-height: 68px; padding: 10px max(16px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97);
}
.customer-brand { color: var(--green-dark); font-size: 24px; font-weight: 900; text-decoration: none; }
.customer-current-field { min-width: 0; overflow: hidden; font-size: 17px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.customer-fields-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--green-dark); font-weight: 750; text-decoration: none; }
.customer-logout { min-height: 44px; background: #fff; border: 1px solid var(--green); color: var(--green-dark); }
.field-card-link { display: block; color: inherit; text-decoration: none; border-radius: 16px; }
.field-choice-card { min-height: 220px; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.field-card-link:hover .field-choice-card, .field-card-link:focus .field-choice-card { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20,91,56,.14); }
.field-open-action { min-height: 48px; display: flex; align-items: center; justify-content: center; margin-top: auto; border-radius: 12px; background: var(--green); color: #fff; font-size: 17px; font-weight: 800; }
.single-field-name { flex: 1; font-size: 17px; text-align: center; }
.equipment-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.equipment-row:last-child { border-bottom: 0; }
@media (max-width: 620px) {
  .field-switcher { align-items: stretch; flex-direction: column; }
  .all-fields-link { width: 100%; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .customer-topbar { grid-template-columns: 1fr auto; gap: 8px; }
  .customer-current-field { grid-column: 1 / -1; grid-row: 2; }
  .customer-fields-link { display: none; }
  .customer-page { width: 100%; padding: 14px; overflow-x: clip; }
  .field-choice-card { min-height: 200px; }
}
.account-panel {
  max-width: 640px;
  margin: 40px auto;
  padding: 28px;
  border: 1px solid #d8e2d5;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(25, 67, 36, 0.08);
}
.account-panel form { display: grid; gap: 12px; }
.account-panel input { width: 100%; box-sizing: border-box; }
.account-page-header { margin-bottom: 26px; }
.account-page-header h1 { margin-bottom: 8px; }
.account-page-header p, .account-help { color: #526657; line-height: 1.55; }
.account-section { padding: 22px 0; border-top: 1px solid #e4ebe2; }
.account-section h2 { margin: 0 0 16px; font-size: 20px; color: var(--green-dark); }
.account-email-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.account-email-value { overflow-wrap: anywhere; font-size: 17px; font-weight: 750; }
.account-status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.account-status-verified { background: #e4f4e8; color: #176331; }
.account-status-unverified { background: #fff2d7; color: #805800; }
.account-status-placeholder { background: #e8eef5; color: #38536e; }
.account-notice, .account-pending-email { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--soft); color: #3f5845; }
.account-pending-email { display: grid; gap: 7px; }
.account-form-field { display: grid; gap: 7px; }
.account-form-field label { font-weight: 750; color: #294c31; }
.account-form-field input { min-height: 48px; padding: 10px 12px; border: 1px solid #b9c9b8; border-radius: 9px; font: inherit; }
.account-form-field input:focus { outline: 3px solid rgba(39, 121, 71, .18); border-color: var(--green); }
.account-form-field.has-error input { border-color: #a72f2f; }
.account-form-error { margin: 0; color: #9b2525; font-weight: 650; }
.account-back-link { display: inline-flex; margin-top: 4px; color: var(--green-dark); font-weight: 750; }
.account-panel table { width: 100%; border-collapse: collapse; }
.account-panel th, .account-panel td { padding: 10px; text-align: left; border-bottom: 1px solid #e4ebe2; }
.account-email { display: block; padding: 8px 0; }
.account-email input { width: auto; }
.account-menu { position: relative; }
.account-menu summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; padding: 0 12px; }
.account-menu-items { position: absolute; right: 0; z-index: 50; min-width: 220px; padding: 8px; border: 1px solid #d8e2d5; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.account-menu-items a, .account-menu-items button { display: block; width: 100%; box-sizing: border-box; padding: 10px; border: 0; background: transparent; color: #244b2b; text-align: left; text-decoration: none; font: inherit; cursor: pointer; }
.account-menu-items a:hover, .account-menu-items button:hover { background: #eef5ec; }
.account-menu-items form { margin: 0; }
@media (max-width: 720px) {
  .account-panel { width: 100%; margin: 18px auto; padding: 20px 16px; box-sizing: border-box; }
  .account-submit, .account-pending-email button { width: 100%; }
  .account-menu summary::before { content: "Μενού → "; }
  .account-menu-items { position: fixed; top: 62px; right: 12px; left: 12px; }
}
