* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: #f4f6f8; color: #1f2937; }
a { color: #005ca8; text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }
.topbar { background: #ffffff; border-bottom: 1px solid #d8dee6; padding: 10px 18px; display: flex; gap: 18px; justify-content: center; }
.wrapper { max-width: 1100px; margin: 24px auto; padding: 0 18px; }
.wrapper.narrow { max-width: 520px; }
.hero { background: linear-gradient(180deg,#ffffff,#eef6ff); border: 1px solid #d8dee6; border-radius: 18px; padding: 24px 30px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; box-shadow: 0 10px 24px rgba(0,0,0,.06); }
.logo-link { display: inline-block; margin-bottom: 10px; }
.site-logo { display: block; width: 160px; max-width: 100%; height: auto; }
h1 { margin: 0; font-size: 30px; letter-spacing: .03em; color: #8b0000; }
h2 { margin-top: 0; color: #8b0000; }
.hero p { margin: 8px 0 0; color: #566274; }
.version { background: #fff; border-radius: 999px; padding: 10px 14px; font-size: 13px; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.08); white-space: nowrap; }
.filters { display: grid; grid-template-columns: 1fr 190px 190px auto auto; gap: 10px; margin: 22px 0; align-items: center; }
input, select, textarea { width: 100%; border: 1px solid #c9d2de; border-radius: 9px; padding: 10px 12px; font: inherit; background: #fff; }
textarea { resize: vertical; }
button, .button-secondary { display: inline-block; border: 0; border-radius: 9px; padding: 10px 16px; background: #b00000; color: #fff; font-weight: 800; cursor: pointer; text-decoration: none; }
button:hover, .button-secondary:hover { text-decoration: none; filter: brightness(.95); }
.button-secondary, .clear { background: #e5e7eb; color: #1f2937; }
.danger { background: #7f1d1d; }
.record-count { color: #6b7280; margin-bottom: 10px; font-weight: 700; }
.directory-list { display: grid; gap: 10px; }
.record-row { background: #fff; border: 1px solid #d8dee6; border-left: 5px solid #b00000; border-radius: 12px; padding: 14px 16px; box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.main-line { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 18px; }
.badge { display: inline-block; background: #eef2f7; color: #374151; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.subcat { color: #6b7280; font-size: 14px; font-weight: 700; }
.url-link { margin-left: auto; }
.detail-line { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 8px; color: #374151; font-size: 14px; line-height: 1.45; }
.notes { margin-top: 8px; padding-top: 8px; border-top: 1px solid #edf0f4; color: #4b5563; font-size: 14px; line-height: 1.45; }
.record-actions { margin-top: 10px; padding-top: 8px; border-top: 1px solid #edf0f4; font-size: 13px; }
.empty, .notice, .panel, .login-box { background: #fff; border: 1px solid #d8dee6; border-radius: 12px; padding: 18px; margin: 18px 0; }
.notice.success { border-color: #80c080; background: #f0fff0; }
.notice.error { border-color: #d66; background: #fff0f0; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.record-form label { display: block; font-weight: 800; margin-bottom: 12px; color: #374151; }
.record-form label input, .record-form label textarea { margin-top: 5px; font-weight: normal; color: #1f2937; }
.check { display: flex !important; align-items: center; gap: 8px; }
.check input { width: auto; }
.admin-list { display: grid; gap: 8px; }
.admin-row { background: #fff; border: 1px solid #d8dee6; border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.admin-row.inactive { opacity: .55; }
.admin-row span { color: #6b7280; font-size: 13px; }
.row-actions { display: flex; gap: 12px; white-space: nowrap; }
.row-actions .delete { color: #9b1c1c; }
footer { text-align: center; color: #6b7280; margin: 28px 0; font-size: 12px; }
@media (max-width: 760px) {
    .hero { flex-direction: column; }
    .filters { grid-template-columns: 1fr; }
    .grid.two { grid-template-columns: 1fr; }
    .url-link { margin-left: 0; }
}

.record-form .full { grid-column: 1 / -1; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.view-tabs a { background: #fff; border: 1px solid #cfd8e3; border-radius: 999px; padding: 9px 14px; color: #374151; }
.view-tabs a.active { background: #b00000; color: #fff; border-color: #b00000; }
.type-badge { display: inline-block; background: #e8f2ff; color: #174b7a; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.checks { border: 1px solid #d8dee6; border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checks legend { font-weight: 800; color: #8b0000; padding: 0 6px; }
.admin-row small { color: #6b7280; line-height: 1.5; }
@media (max-width: 980px) {
    .filters { grid-template-columns: 1fr 1fr; }
}
.filters { grid-template-columns: minmax(220px,1fr) 180px 180px 150px 190px auto auto; }
@media (max-width: 980px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr; } }

.field-help { margin: 0 0 12px; color: #6b7280; font-size: 13px; line-height: 1.45; }
.contacts-panel, .credentials-panel { border: 1px solid #d8dee6; border-radius: 12px; padding: 14px; margin: 0 0 16px; background: #fbfdff; }
.contacts-panel legend, .credentials-panel legend { font-weight: 800; color: #8b0000; padding: 0 6px; }
.credentials-panel summary {
    color: #8b0000;
    cursor: pointer;
    font-weight: 800;
    line-height: 1.35;
}
.credentials-panel[open] summary { margin-bottom: 12px; }
.credentials-panel summary:focus-visible {
    border-radius: 5px;
    outline: 3px solid rgba(0, 92, 168, .28);
    outline-offset: 3px;
}
.contact-slot { border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; margin: 12px 0; background: #fff; }
.contact-slot.hidden { display: none; }
.contact-slot-title { font-weight: 800; color: #374151; margin-bottom: 10px; }


/* v1.1.12 phone refinements */
.version-badge,
.version {
  background: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  white-space: nowrap;
}
.record-row,
.record-row * {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar {
    padding: 8px 12px;
    gap: 12px;
  }
  .wrapper {
    width: 100%;
    margin: 12px auto;
    padding: 0 10px;
  }
  .wrapper.narrow { max-width: none; }
  .hero {
    position: relative;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 14px;
  }
  .hero p {
    display: none;
  }
  .logo-link {
    margin-bottom: 8px;
  }
  .site-logo {
    width: 125px;
  }
  h1 {
    font-size: 28px;
    line-height: 1.12;
    letter-spacing: .02em;
  }
  .version-badge,
  .version {
    align-self: flex-start;
    margin-top: 4px;
    padding: 4px 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    font-size: 13px;
  }
  .filters {
    gap: 8px;
    margin: 14px 0;
  }
  input, select, textarea {
    font-size: 16px;
    padding: 10px 11px;
    border-radius: 8px;
  }
  .record-count {
    font-size: 16px;
    line-height: 1.25;
    margin: 12px 0 8px;
  }
  .directory-list {
    gap: 12px;
  }
  .record-row {
    border-left-width: 4px;
    border-radius: 10px;
    padding: 12px 12px 12px 10px;
  }
  .main-line {
    gap: 7px 8px;
    font-size: 18px;
    line-height: 1.25;
  }
  .type-badge,
  .badge {
    font-size: 11px;
    padding: 4px 8px;
    letter-spacing: .035em;
    max-width: 100%;
  }
  .subcat {
    font-size: 14px;
    line-height: 1.25;
  }
  .url-link {
    margin-left: 0;
    display: inline-block;
    max-width: 100%;
  }
  .detail-line {
    display: block;
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.42;
  }
  .detail-line span {
    display: block;
    margin: 0 0 8px 0;
    max-width: 100%;
  }
  .notes {
    font-size: 15px;
    line-height: 1.45;
  }
}


.compact-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
    line-height: 1.7;
}

.muted {
    color: #666;
    font-size: 0.9em;
}

.admin-codes-panel code {
    background: #f2f2f2;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 5px;
}


/* v1.1.22 direct directory administration and quick actions */
.compact-admin-panel { padding: 14px 18px; margin: 16px 0; }
.compact-admin-panel h2 { margin: 0 0 10px; }
.access-code-columns { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px 24px; line-height: 1.8; }
.access-code-columns code { margin-left: 6px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.quick-actions a { font-weight: 700; }
.quick-actions .delete { color: #a40000; }
@media (max-width: 760px) { .access-code-columns { grid-template-columns: 1fr; } }

/* v1.1.23 sticky directory header and in-card administration */
.directory-hero-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 18px;
}
.hero-main { min-width: 0; }
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 14px;
}
.hero-action {
    display: inline-block;
    padding: 8px 13px;
    border: 1px solid #bfd0e1;
    border-radius: 9px;
    background: #fff;
    color: #005ca8;
    font-weight: 800;
}
.hero-action.primary {
    background: #b00000;
    border-color: #b00000;
    color: #fff;
}
.hero-action:hover { text-decoration: none; filter: brightness(.97); }
@media (max-width: 760px) {
    .directory-hero-sticky { top: 0; }
    .hero-actions { margin-top: 10px; }
    .hero-action { padding: 8px 11px; }
}

/* v1.1.25 on-demand admin authorization */
.admin-modal[hidden] { display: none; }
.admin-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.admin-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.48); }
.admin-modal-dialog { position: relative; width: min(460px, 100%); background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.admin-modal-dialog h2 { margin: 0 0 8px; color: #920000; }
.admin-modal-dialog p { margin: 0 0 18px; color: #4c5a68; }
.admin-modal-dialog label { display: block; font-weight: 800; margin-bottom: 7px; }
.admin-modal-dialog input { width: 100%; box-sizing: border-box; font-size: 18px; padding: 11px 12px; }
.admin-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.admin-modal-close { position: absolute; right: 12px; top: 8px; border: 0; background: transparent; color: #555; font-size: 28px; line-height: 1; padding: 4px 8px; }
.modal-open { overflow: hidden; }


/* v1.1.26 consolidated admin header and on-demand access-code panel */
.access-codes-collapsible[hidden] { display: none; }
.access-codes-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.access-codes-heading h2 { margin-top: 0; }
.access-codes-heading .field-help { margin-bottom: 16px; }
@media (max-width: 760px) {
    .access-codes-heading { display: block; }
    .access-codes-heading .button-secondary { margin-bottom: 14px; }
}


/* v1.1.27 admin access-code toggle and clearer view navigation */
.view-tabs {
    width: 100%;
    box-sizing: border-box;
    padding-right: 0;
    overflow: hidden;
}
.view-tabs a {
    box-sizing: border-box;
    background: #ffffff;
    border-color: #c9d5e3;
    color: #215d8f;
    font-weight: 800;
}
.view-tabs a.active {
    background: #dfeefa;
    color: #0b4f7a;
    border-color: #8fb8d7;
    box-shadow: inset 0 -3px 0 #2f79ad;
}
.access-codes-collapsible {
    scroll-margin-top: 180px;
}
@media (max-width: 760px) {
    .view-tabs {
        gap: 8px;
    }
    .view-tabs a {
        flex: 1 1 auto;
        text-align: center;
        padding-left: 10px;
        padding-right: 10px;
    }
}


/* v1.1.29 clearer link purpose and separated record controls */
.url-link {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.url-link-label {
    color: #66717c;
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.grouped-record-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px 18px;
}
.action-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.action-group + .action-group {
    border-left: 1px solid #d6dde5;
    padding-left: 18px;
}
.action-group-label {
    color: #66717c;
    font-size: 0.72em;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.action-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}
.action-links a { font-weight: 700; }
.record-control-group .delete { color: #a40000; }
@media (max-width: 640px) {
    .action-group + .action-group {
        border-left: 0;
        border-top: 1px solid #d6dde5;
        padding-left: 0;
        padding-top: 9px;
        width: 100%;
    }
}

/* v1.1.30 communication actions and multi-number call dialog */
.text-action-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: #005ca8;
    font: inherit;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
}
.text-action-link:hover { text-decoration: underline; }
.communication-links a,
.communication-links button { white-space: nowrap; }
.call-modal[hidden] { display: none; }
.call-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 20px;
}
.call-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.48); }
.call-modal-dialog {
    position: relative;
    width: min(620px, 100%);
    max-height: min(82vh, 720px);
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.call-modal-dialog h2 { margin: 0 36px 6px 0; color: #920000; }
.call-modal-help { margin: 0 0 16px; color: #4c5a68; line-height: 1.45; }
.call-modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 28px;
    line-height: 1;
    padding: 4px 8px;
}
.call-options-list { display: grid; gap: 10px; margin-bottom: 16px; }
.call-option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border: 1px solid #d8dee6;
    border-radius: 11px;
    padding: 12px 14px;
    background: #fbfdff;
}
.call-option-info { display: grid; gap: 3px; min-width: 0; }
.call-option-info strong { color: #27384a; }
.call-option-info span { font-size: 1.08rem; }
.call-option-info small { color: #66717c; }
.call-option-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.call-option-call,
.call-option-copy {
    display: inline-block;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 800;
    text-align: center;
}
.call-option-call { background: #005ca8; border: 1px solid #005ca8; color: #fff; }
.call-option-call:hover { color: #fff; text-decoration: none; filter: brightness(.96); }
.call-copy-status { min-height: 1.4em; margin: 0 0 10px; color: #27632a; font-weight: 700; }
@media (max-width: 560px) {
    .call-modal-dialog { padding: 20px 16px; }
    .call-option-row { align-items: stretch; flex-direction: column; }
    .call-option-actions { width: 100%; }
    .call-option-actions > * { flex: 1 1 0; }
}


/* v1.2.0 email and multi-resource communication */
.resource-slot { border:1px solid #e2e8f0; border-radius:12px; padding:12px; margin:12px 0; background:#fff; }
.resource-slot.hidden { display:none; }
.webmail-button { display:inline-block; margin:10px 8px 10px 0; }
.call-option-actions { flex-wrap:wrap; }
@media (max-width:760px){ .call-option-row{align-items:flex-start;} .call-option-actions{width:100%;} }


/* v1.2.1 master-admin communication settings */
.communication-settings-panel { scroll-margin-top: 180px; }
.settings-form fieldset { margin: 16px 0; }
.settings-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.hero-action.active { background:#dfeefa; color:#0b4f7a; border-color:#8fb8d7; }
@media (max-width:640px){ .settings-actions > * { width:100%; text-align:center; box-sizing:border-box; } }

/* v1.2.2 application-style buttons and action controls */
.hero-action,
.button-secondary,
.view-tabs a,
.call-option-call,
.webmail-button,
.action-links a,
.row-actions a,
.text-action-link,
a.clear {
    text-decoration: none;
}

.hero-action:hover,
.hero-action:focus,
.button-secondary:hover,
.button-secondary:focus,
.view-tabs a:hover,
.view-tabs a:focus,
.call-option-call:hover,
.call-option-call:focus,
.webmail-button:hover,
.webmail-button:focus,
.action-links a:hover,
.action-links a:focus,
.row-actions a:hover,
.row-actions a:focus,
.text-action-link:hover,
.text-action-link:focus,
a.clear:hover,
a.clear:focus {
    text-decoration: none;
}

.hero-action,
.button-secondary,
.view-tabs a,
.call-option-call,
.webmail-button,
.action-links a,
.row-actions a,
.text-action-link,
a.clear,
button {
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease, filter .15s ease;
}

.hero-action:hover,
.button-secondary:hover,
.view-tabs a:hover,
.call-option-call:hover,
.webmail-button:hover,
.action-links a:hover,
.row-actions a:hover,
.text-action-link:hover,
a.clear:hover,
button:hover {
    box-shadow: 0 2px 7px rgba(27, 61, 92, .13);
}

.hero-action:active,
.button-secondary:active,
.view-tabs a:active,
.call-option-call:active,
.webmail-button:active,
.action-links a:active,
.row-actions a:active,
.text-action-link:active,
a.clear:active,
button:active {
    transform: translateY(1px);
}

.hero-action:focus-visible,
.button-secondary:focus-visible,
.view-tabs a:focus-visible,
.call-option-call:focus-visible,
.webmail-button:focus-visible,
.action-links a:focus-visible,
.row-actions a:focus-visible,
.text-action-link:focus-visible,
a.clear:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(37, 117, 173, .28);
    outline-offset: 2px;
}

/* Compact controls within directory records. */
.action-links a,
.text-action-link,
.row-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid #c8d7e5;
    border-radius: 7px;
    background: #f7fbff;
    color: #075f9f;
    line-height: 1.1;
    font-size: 13px;
    font-weight: 800;
}

.action-links a:hover,
.text-action-link:hover,
.row-actions a:hover {
    background: #eaf4fc;
    border-color: #9dbbd2;
    color: #064f84;
}

.record-control-group .delete,
.row-actions .delete {
    border-color: #e4b7b7;
    background: #fff7f7;
    color: #a40000;
}

.record-control-group .delete:hover,
.row-actions .delete:hover {
    border-color: #cf8e8e;
    background: #fdecec;
    color: #870000;
}

/* The active view is a selected navigation tab, not a text link. */
.view-tabs a.active,
.view-tabs a.active:hover,
.view-tabs a.active:focus {
    text-decoration: none;
}
