/* hezotech theme: black background, amber-gold accent. Mobile-first. */

:root {
    --bg:        #0d0d0d;
    --card:      #1a1a1a;
    --card-2:    #222;
    --border:    #2e2e2e;
    --text:      #f2f2f2;
    --muted:     #9a9a9a;
    --accent:    #F5A623;
    --accent-d:  #d98e10;
    --ok:        #3ecf8e;
    --err:       #ff5d5d;
    --radius:    16px;
    --field-h:   50px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}
.wrap.narrow { max-width: 420px; }
/* Admin needs more room so the edit row fits without horizontal scroll. */
.wrap.wide { max-width: 1080px; }

/* Header */
.app-header { margin-bottom: 18px; }
.brand-logo { display: block; height: 34px; width: auto; max-width: 70%; margin-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.logo h1 { font-size: 22px; margin: 0; color: var(--text); }
.subtitle { color: var(--muted); font-size: 14px; margin: 8px 2px 0; line-height: 1.4; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 18px;
}
.card-title { font-size: 17px; margin: 0 0 12px; }

/* Fields */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field-hint { display: block; margin-top: 5px; min-height: 14px; }

input[type="text"], input[type="tel"], input[type="password"], select {
    width: 100%;
    min-height: var(--field-h);
    padding: 12px 14px;
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;          /* >=16px stops iOS auto-zoom */
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,166,35,.15); }

/* Custom dropdown chevron (amber) */
select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23F5A623' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
select:invalid { color: var(--muted); }     /* placeholder option looks muted */
input::placeholder { color: #6a6a6a; }

.input-error { border-color: var(--err) !important; box-shadow: 0 0 0 3px rgba(255,93,93,.12) !important; }
.input-ok    { border-color: var(--ok)  !important; }

/* Phone row: small country code + number */
.phone-row { display: flex; gap: 8px; }
.phone-row .slot-cc { width: 78px; flex: 0 0 78px; text-align: center; font-weight: 600; }
.phone-row .slot-phone { flex: 1; }

/* Slots */
.slot {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    background: rgba(255,255,255,.015);
}
.slot-head { margin-bottom: 10px; }
.slot-num { font-size: 13px; font-weight: 600; color: var(--accent); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--field-h);
    padding: 12px 18px;
    border: none; border-radius: 12px;
    font-size: 16px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: background .15s, opacity .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { width: 100%; background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-d); }
.btn-primary.loading { opacity: .6; pointer-events: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Messages */
.msg { padding: 12px 14px; border-radius: 12px; margin-top: 14px; font-size: 14px; }
.msg-success { background: rgba(62,207,142,.12); border: 1px solid rgba(62,207,142,.4); color: var(--ok); }
.msg-error   { background: rgba(255,93,93,.10); border: 1px solid rgba(255,93,93,.4); color: var(--err); }

.info-line { padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--muted); background: var(--card-2); margin-bottom: 14px; }
.info-line.warn { color: var(--err); background: rgba(255,93,93,.08); border: 1px solid rgba(255,93,93,.3); }

/* Public list (grouped by apartment) */
.list { margin-top: 8px; }
.apt-group {
    margin: 16px 0 4px;
    font-weight: 700;
    color: var(--accent);
    font-size: 15px;
    letter-spacing: .02em;
}
.apt-group:first-child { margin-top: 4px; }
.list-head, .list-row {
    display: grid; grid-template-columns: 1fr 1fr 78px; gap: 8px;
    padding: 8px 6px; align-items: center;
}
.list-head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.list-head span:last-child, .mem-cell { text-align: center; }
.list-row { border-bottom: 1px solid var(--border); font-size: 14px; }
.masked { letter-spacing: 1px; color: var(--muted); }
.mem-yes { color: var(--ok); font-weight: 700; }
.mem-no  { color: #555; }

/* Stats */
.stats { display: flex; gap: 12px; margin-bottom: 18px; }
.stat { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-num { display: block; font-size: 26px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); }

/* Admin table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table .mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.admin-table input { min-height: 38px; padding: 6px 8px; font-size: 14px; }
.col-mem { text-align: center; white-space: nowrap; }
.admin-table .col-mem .mem-yes { color: var(--ok); font-weight: 700; font-size: 16px; }
.admin-table .col-mem .mem-no  { color: #555; }
.actions { white-space: nowrap; text-align: right; }

/* Barrier code cell */
.c-code { min-width: 230px; }
.c-code .code { display: inline-block; color: var(--accent); font-size: 13px; }
.code-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.code-edit .slot-x { width: 64px; min-height: 34px; padding: 4px 6px; text-align: center; }
.btn-sm {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #000; border: none; border-radius: 8px;
    padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none;          /* for <a> styled as buttons */
}
.btn-sm:hover { background: var(--accent-d); }
.btn-sm.sms { background: #2563eb; color: #fff; }
.btn-sm.sms:hover { background: #1d4fd0; }
/* color:#000 needed because the .ok utility class would otherwise tint the
   label green (same green as the background = invisible text). */
.btn-sm.ok { background: var(--ok); color: #000; }
.btn-sm.ok:hover { filter: brightness(1.05); }
.btn-sm.cancel { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn-sm.cancel:hover { border-color: var(--err); color: var(--err); background: var(--card-2); }
.icon-btn { background: var(--card-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 15px; margin-left: 4px; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--err); color: var(--err); }
.icon-btn.ok:hover { border-color: var(--ok); color: var(--ok); }

/* Utilities */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--err); }
.ok  { color: var(--ok); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.app-footer { text-align: center; margin-top: 8px; }
