/* ===== Global base (LOKRA) ===== */
:root{
  --bg: #fff;
  --text: #111;
  --muted: #555;
  --border: #ccc;
  --panel: #fafafa;
  --panel2: #f9f9f9;
}
*, *::before, *::after {
  box-sizing: border-box;
}

html, body{
  margin:8px;
  padding:0;
}

body{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Optional: if you use a wrapper like .page-inner already */
.page-inner{
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 1.5rem;
}

/* ===== Tables ===== */
.table-wrap{
  overflow-x:auto;          /* allows horizontal scroll if needed */
  -webkit-overflow-scrolling: touch;
}

table{
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-size: 0.9rem;
  background: #fff;
}

th, td{
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

th{
  background: #eee;
  font-weight: 600;
}

tr:nth-child(even) td{
  background: #fafafa;
}
/* Desktop table: subtle info highlight when expanded */
tr.entry-row.is-open td {
  background: #fff7db;
}

tr.details-row.is-open td {
  background: #fff7db;
}
/* Details row: closed state should not draw anything */
tr.details-row td{
  padding: 0;
  border: 0;
  background: transparent;
}

/* When open, it becomes a real "panel" */
tr.details-row.is-open td{
  padding: 10px;
  border: 1px solid var(--border);
  background: #fff7db;
  border-radius: 10px; /* harmless on desktop, nice on mobile */
}


@media (max-width: 700px) {
  table {
    border: 0;
    table-layout: auto;
  }

  thead {
    display: none;
  }

  /* Each normal row becomes a card */
  tbody tr.entry-row {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 10px 0;
    background: #fff;
  }

  /* Each cell becomes a stacked field: label on top, value under */
  tbody tr.entry-row td {
    display: block;            /* <-- key change */
    border: 0;
    padding: 8px 0;
  }

  tbody tr.entry-row td::before {
    content: attr(data-label);
    display: block;            /* <-- key change */
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
  }

  /* Actions: keep icons on one line, and hide the "Actions" label */
  tbody td.cell-actions {
    padding-top: 10px;
    white-space: normal;       /* override inline nowrap if present */
  }
  tbody td.cell-actions::before {
    content: none;
  }

  /* --- Details row special handling --- */

/* Details row: closed = no card visuals */
tr.details-row{
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

tr.details-row td{
  display:block;
  padding: 0;
  border: 0;
  background: transparent;
}

tr.details-row td::before{ content:none; }

/* Open = it gets the panel look */
tr.details-row.is-open td{
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff7db;
}
  /* When details are open: highlight both the overview card and the details card */
  tr.entry-row.is-open {
    background: #fff7db;              
    border-color: #bfc5cd;
  }

  tr.details-row.is-open td {
    background: #fff7db;              
    border-color: #bfc5cd;
  }
}
tbody tr{
  transition: background-color 120ms ease, border-color 120ms ease;
}


/* ===== LOKRA top header (clean + predictable) ===== */
.topnav{
  background:#1f2937;
  color:#fff;
  border:1px solid #fff;
  box-sizing:border-box;
}

.topnav-bar{
  display:flex;
  align-items:center;
  gap:18px;
  padding:10px 14px;
}

.topnav-logo{ display:inline-flex; align-items:center; }
.topnav-logo-img{ height:34px; width:auto; display:block; }

/* Burger: hidden on desktop */
.topnav-burger{
  display:none;
  appearance:none;
  border:0;
  background:transparent;
  color:#fff;
  cursor:pointer;
}

/* Main nav row (desktop default) */
.topnav-nav{
  display:flex;
  align-items:center;
  gap:18px;
  flex:1;
  flex-wrap:wrap;
}

/* Links + dropdown button share styling */
.topnav-link,
.topnav-dropbtn{
  appearance:none;
  background:none;
  border:0;
  color:#fff;
  font:inherit;
  font-size:20px;
  line-height:1.2;
  text-decoration:none;
  padding:0;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
}

.topnav-link:hover,
.topnav-dropbtn:hover{
  text-decoration:underline;
}

/* User block aligned right on desktop */
.topnav-user{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:18px;
  white-space:nowrap;
}

.topnav-user-email{
  font-size:20px;
}

/* ===== Dropdown (desktop hover) ===== */
.topnav-dropdown{
  position:relative;
  display:inline-flex;
  align-items:center;
}

.topnav-dropdown-content{
  display:none;
  position:absolute;
  top:100%;
  left:0;
  z-index:1000;
  margin-top:8px;

  background:#1f2937;
  border-radius:8px;
  min-width:220px;
  padding:8px 0;
  box-shadow:0 10px 22px rgba(0,0,0,.25);
}

/* small "hover bridge" so you can move into the menu */
.topnav-dropdown::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:100%;
  height:8px;
}

.topnav-dropdown:hover > .topnav-dropdown-content{
  display:block;
}

.topnav-dropdown-content a{
  display:block;
  padding:8px 14px;
  font-size:16px;
  color:#fff;
  text-decoration:none;
  white-space:nowrap;
}

.topnav-dropdown-content a:hover{
  background:#374151;
}

/* ===== Mobile ===== */
@media (max-width: 700px){
  .topnav-bar{
    justify-content:space-between;
    flex-wrap:wrap;            /* menu goes to next line */
    gap:10px;
  }

  .topnav-burger{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    width:42px;
    height:42px;

    border:1px solid rgba(255,255,255,.22);
    border-radius:10px;
    background: rgba(255,255,255,.06);
    font-size:26px;
    line-height:1;
  }

  .topnav-burger:hover{
    background: rgba(255,255,255,.12);
  }

  .topnav-burger:focus-visible{
    outline:2px solid rgba(200,16,46,.7);
    outline-offset:2px;
  }

  /* Menu: hidden by default, shown when .is-open is toggled by JS */
  .topnav-nav{
    display:none;
    flex-basis:100%;
    width:100%;
    flex-direction:column;
    align-items:stretch;
    gap:6px;

    padding-top:10px;
    margin-top:10px;
    border-top:1px solid rgba(255,255,255,.18);
  }

  .topnav-nav.is-open{
    display:flex;
  }

  /* Full-width tap targets */
  .topnav-link,
  .topnav-dropbtn{
    width:100%;
    justify-content:flex-start;
    padding:8px 10px;
    border-radius:6px;
  }

  .topnav-link:hover,
  .topnav-dropbtn:hover{
    background:#374151;
    text-decoration:none;
  }

  /* User block stacks, no right-push */
  .topnav-user{
    margin-left:0;
    width:100%;
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    white-space:normal;

    padding-top:10px;
    margin-top:10px;
    border-top:1px solid rgba(255,255,255,.18);
  }

  .topnav-user-email{
    width:100%;
    overflow-wrap:anywhere;
  }

  /* Dropdown becomes always-visible list under its button (no hover on mobile) */
  .topnav-dropdown{
    display:block;
    width:100%;
    position:static;
  }

  .topnav-dropdown::after{
    display:none; /* remove hover bridge */
  }

  .topnav-dropdown-content{
    display:block;
    position:static;
    margin:0;
    padding:4px 0 0;
    min-width:0;
    box-shadow:none;
    background:transparent;
    border-radius:0;
  }

  .topnav-dropdown-content a{
    padding:8px 10px 8px 24px; /* indent */
    white-space:normal;
  }
}
.icon-btn svg{
  display:block;
}
.topnav-bar{
  display:flex;
  align-items:center;
  gap:18px;
  padding:10px 14px;
}

/* Push locale selector to far right */
.topnav-locale{
  display:flex;
  align-items:center;
}

/* Language selector (navbar, incl. login page) */
.topnav-locale select{
  background-color: #1f2937;   /* same as navbar */
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
}

/* IMPORTANT: style the dropdown items */
.topnav-locale select option{
  background-color: #1f2937;
  color: #fff;
}

.topnav-locale select:focus-visible{
  outline:2px solid rgba(59,130,246,.9);
  outline-offset:2px;
}


.sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}
/* icon-only actions (no button chrome) */
.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  width: 28px;
  height: 28px;

  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 6px;

  color: #2563eb; /* matches your blue pencil vibe */
  text-decoration: none;
  cursor: pointer;
}

.icon-btn:hover{
  background: rgba(0,0,0,.06);
}

.icon-btn:focus-visible{
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.icon-btn svg{
  display:block;
}

.icon-btn svg{
  width: 20px;
  height: 20px;
}
.icon-btn:hover{
  background:#f3f4f6; /* light hover */
}

.icon-btn:focus-visible{
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.flash{
  margin: 12px auto;
  padding: 12px 16px;
  max-width: 900px;           /* match .page-inner */
  border-radius: 10px;
  box-sizing: border-box;
}
.flash.success{
  background: #dcfce7;
  border: 1px solid #22c55e;
  color: #065f46;
}

.flash.error{
  background: #fee2e2;        /* stronger red background */
  border: 1px solid #ef4444;  /* clear edge */
  color: #7f1d1d;             /* readable, not screaming */
}

.flash.warn,
.flash.warning  {
  background: #fffbeb;
  border-bottom-color: #f59e0b;
  color: #78350f;
}
.flash{
  transition: opacity 400ms ease, max-height 400ms ease;
}

/* ===== Edit form v2 (single column everywhere) ===== */
.ef-grid{
  display:grid;
  grid-template-columns: 1fr;   /* <- single column on desktop AND mobile */
  gap: 12px;
  margin-top: 12px;
}

/* ef-span-2 becomes harmless/no-op in a 1-col grid, but keep it for compatibility */
.ef-span-2{ grid-column: auto; }

@media (max-width: 700px){
  .ef-grid{ grid-template-columns: 1fr; }
}

.ef-span-2{ grid-column: span 2; }
@media (max-width: 700px){
  .ef-span-2{ grid-column: auto; }
}

.ef-field{
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.ef-field input,
.ef-field select,
.ef-field textarea{
  width: 100%;
  padding: 10px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.ef-field textarea{ resize: vertical; }

.ef-field input:focus,
.ef-field select:focus,
.ef-field textarea:focus{
  outline: 2px solid rgba(200,16,46,.35);
  outline-offset: 2px;
  border-color: rgba(200,16,46,.45);
}

.ef-label{
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.ef-help{
  margin-top: 6px;
  font-size: 0.9rem;
  color: #6b7280;
}

.ef-field--readonly{
  background: var(--panel);
}

.ef-field--readonly input{
  background: #f3f4f6;
  color: #374151;
}

.ef-field--check{
  display:flex;
  align-items:flex-start;
  gap: 10px;
}

.ef-field--check input[type="checkbox"]{
  width: 18px;
  height: 18px;
  margin-top: 4px;
}

.ef-check-title{
  font-weight: 700;
  color: var(--text);
}
.field {
  margin-bottom: 10px;
}
.field-label {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}
.field-value {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

/* Details slide animation */
.details-row .details-inner{
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 220ms ease, opacity 160ms ease, transform 160ms ease;
}

/* Open state */
.details-row.is-open .details-inner{
  max-height: 1200px; /* big enough to fit your details */
  opacity: 1;
  transform: translateY(0);
}
.details-row .details-inner{
  will-change: max-height, opacity, transform;
}

/* burger hidden on desktop */
.topnav-burger{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    padding:8px 10px;
    font-size:28px;
    line-height:1;

    width:auto;          /* IMPORTANT */
    background:transparent;
  }
.topnav-burger:hover{ background:#374151; }
.topnav-burger:focus-visible{
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

@media (max-width: 700px){
  /* show burger on mobile */
  .topnav-burger{ display:inline-flex; align-items:center; justify-content:center; }

  /* hide menu by default */
  .topnav-nav{ display:none; }

  /* show menu when toggled */
  .topnav-nav.is-open{ display:flex; }

  /* keep your mobile vertical layout when open */
  .topnav-nav.is-open{
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,.18);
    width:100%;
  }
}
@media (max-width: 700px){
  .topnav-nav{
    display:none;
    width:100%;
  }

  .topnav-nav.is-open{
    display:flex;
    flex-direction:column;
    align-items:stretch;
  }
}
/* --- Burger button (make it not ugly) --- */
.topnav-burger{
  display:none;              /* desktop */
  appearance:none;
  border:0;
  background:transparent;
  color:#fff;
  cursor:pointer;
}

@media (max-width: 700px){
  .topnav-bar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;          /* KEY: allows nav to go to next line */
    gap:10px;
	padding:8px 12px;
  }

  .topnav-burger{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    width:30px;
    height:30px;

    border:1px solid rgba(255,255,255,.22);
    border-radius:10px;
    background: rgba(255,255,255,.06);
    font-size:20px;
    line-height:1;
  }

  .topnav-burger:hover{
    background: rgba(255,255,255,.12);
  }

  .topnav-burger:focus-visible{
    outline:2px solid rgba(200,16,46,.7);
    outline-offset:2px;
  }

  /* The menu itself: hidden by default */
  .topnav-nav{
    display:none;
    flex-basis:100%;         /* KEY: forces it onto a new line */
    width:100%;
    flex-direction:column;
    align-items:stretch;
    gap:6px;

    padding-top:10px;
    margin-top:10px;
    border-top:1px solid rgba(255,255,255,.18);
  }

  /* When opened, it becomes visible */
  .topnav-nav.is-open{
    display:flex;
  }

  /* Make links full-width tap targets (keep your existing styling idea) */
  .topnav-link,
  .topnav-dropbtn{
    width:100%;
    justify-content:flex-start;
    padding: 8px 10px;
    border-radius: 6px;
  }

  .topnav-link:hover,
  .topnav-dropbtn:hover{
    background:#374151;
    text-decoration:none;
  }
}
@media (max-width: 700px){
  .topnav-nav{
    display:flex;              /* keep it flex */
    max-height:0;
    overflow:hidden;
    opacity:0;
    transform: translateY(-6px);
    transition: max-height 220ms ease, opacity 160ms ease, transform 160ms ease;
  }

  .topnav-nav.is-open{
    max-height: 80vh;          /* big enough */
    opacity:1;
    transform: translateY(0);
  }
}
@media (max-width:700px){
  .topnav-nav .topnav-locale{ width:100%; }
  .topnav-nav .topnav-locale select{ width:100%; }
}

/* ===== Login ===== */
.login-wrap{
  min-height: calc(100vh - 120px); /* header + flash space */
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 20px;
}

.login-card{
  width:100%;
  max-width:360px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:20px;
}

.login-title{
  margin:0 0 14px;
  font-size:1.4rem;
  text-align:center;
}

.login-btn{
  width:100%;
  margin-top:10px;
  padding:10px 12px;
  font:inherit;
  border:0;
  border-radius:10px;
  background:#2563eb; /* same blue family as navbar/icons */
  color:#fff;
  cursor:pointer;
}

.login-btn:hover{
  background:#1d4ed8;
}

.login-btn:focus-visible{
  outline:2px solid #2563eb;
  outline-offset:2px;
}

/* Secondary button (Cancel) */
.btn-secondary{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  padding:10px 12px;
  border-radius:10px;
  font:inherit;
  text-decoration:none;
  cursor:pointer;

  background:#e5e7eb;
  color:#111827;
  width:100%
}

.btn-secondary:hover{
  background:#d1d5db;
}

.btn-secondary:focus-visible{
  outline:2px solid rgba(107,114,128,.7);
  outline-offset:2px;
}

.form-actions{
  display: flex;
  flex-direction: column;  /* ← THIS is the missing line */
  gap: 10px;
  margin-top: 16px;
}
/* Danger button (disable, delete, revoke) */
.btn-danger{
  width:100%;
  padding:10px 12px;
  font:inherit;

  border:1px solid #dc2626;
  border-radius:10px;

  background:#ef4444;
  color:#fff;

  cursor:pointer;
}

.btn-danger:hover{
  background:#dc2626;
}

.btn-danger:focus-visible{
  outline:2px solid #dc2626;
  outline-offset:2px;
}

.btn-auto{ /*MUST BE LAST ENTRY AFTER BUTTONS!!!! */
  width: auto;
  align-self: flex-start; /* important inside flex column */
}
.camera-modal{
  border:0;
  padding:0;
  border-radius:14px;
  width:min(92vw, 560px);
}
.camera-modal::backdrop{ background: rgba(0,0,0,.55); }

.camera-inner{
  background:#fff;
  padding:14px;
}

.camera-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.camera-title{
  font-weight:700;
  font-size:16px;
}

.camera-video{
  width:100%;
  border-radius:12px;
  background:#111;
}

.camera-actions{
  display:flex;
  gap:10px;
  justify-content:space-between;
  margin-top:12px;
  flex-wrap:wrap;
}

.camera-actions .btn-auto{ white-space:nowrap; }
/* --- Entry image row: desktop inline, mobile stacked --- */
.ef-media-row{
  display:flex;
  align-items:center;
  gap:10px;
}

.ef-media-left{
  flex:1;
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
}

.ef-media-thumb{
  width:90px;
  height:90px;
  object-fit:cover;
  border-radius:10px;
  border:1px solid #ddd;
  flex:0 0 auto;
}

.ef-media-placeholder{
  width:90px;
  height:90px;
  border-radius:10px;
  border:1px dashed #bbb;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#666;
  font-size:12px;
  flex:0 0 auto;
}

.ef-media-text{
  min-width:0;
}

/* Mobile: let it wrap and put the button on its own row */
@media (max-width: 700px){
  .ef-media-row{
    flex-wrap:wrap;
    align-items:flex-start;
  }
  .ef-media-left{
    width:100%;
  }
  #btn_take_photo{
    width:100%;
  }
}
/* Base: locale itself should NOT push anything by default */
.topnav-locale{
  display:flex;
  align-items:center;
  margin-left: 0;          /* important */
}

/* Logged-out/login: selector is in the bar -> push it to the right */
.topnav-bar > .topnav-locale{
  margin-left: auto;
}

/* Logged-in desktop: locale is inside nav -> keep it next to user */
@media (min-width: 701px){
  .topnav-nav .topnav-locale{
    margin-left: 0;        /* DO NOT add margin */
  }
}

.parent-results{
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.parent-result-item{
  display:block;
  width:100%;
  text-align:left;
  padding:10px;
  border:0;
  background:#fff;
  cursor:pointer;
  font:inherit;
}

.parent-result-item:hover{
  background:#f3f4f6;
}
