* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: #111; color: #2a2a2a; font: 16px/1.5 Arial, sans-serif; }
[hidden] { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: #111; }
.login-box { width: min(100%, 24rem); min-width: 0; padding: 2rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; border-top: .4rem solid #d7263d; border-radius: .75rem; background: #fff; }
.login-box img { width: 9rem; max-width: 100%; height: auto; margin: 0 auto .75rem; }
.login-box h1 { text-align: center; }
.login-box label, .login-box input { width: 100%; min-width: 0; }
.login-box button { border: 0; background: #d7263d; color: #fff; font-weight: 700; cursor: pointer; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 3.2rem; }
.login-box .password-toggle { position: absolute; top: 50%; right: .25rem; width: 2.4rem; min-height: 2.3rem; padding: .5rem; transform: translateY(-50%); border-radius: .35rem; background: transparent; color: #444; }
.password-toggle svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; }
.password-toggle:focus-visible { outline: 2px solid #d7263d; outline-offset: 1px; }
.login-box p { min-height: 1.5rem; margin: 0; color: #a61b2b; }
body.panel-open { background: #f4f4f4; }
.admin-panel { width: min(95%, 92rem); margin: 1.25rem auto; padding: clamp(1.15rem, 2vw, 1.75rem); border-top: .4rem solid #d7263d; border-radius: .75rem; background: #fff; box-shadow: 0 4px 16px #1111; }
header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
h1 { margin: 0; font-size: 1.6rem; }
.status { padding: .35rem .7rem; border-radius: 999px; background: #e6e6e6; font-weight: 700; }
.status.active { background: #d7263d; color: #fff; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(22rem, 2fr); gap: clamp(1.25rem, 2vw, 2rem); align-items: start; }
.admin-layout > * { min-width: 0; }
form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem 1rem; }
label { display: grid; gap: .35rem; font-weight: 700; }
.wide { grid-column: 1 / -1; }
input, textarea, select, button { min-width: 0; min-height: 2.7rem; padding: .6rem .65rem; border: 1px solid #b2b2b2; border-radius: .4rem; font: inherit; }
textarea { min-height: 6rem; resize: vertical; }
.check { display: flex; align-items: center; gap: .6rem; }
.check input { width: 1.2rem; height: 1.2rem; min-height: auto; }
.date-time-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.actions button { border: 0; background: #2a2a2a; color: #fff; font-weight: 700; cursor: pointer; }
.actions .primary { background: #d7263d; }
.actions .disable { border: 1px solid #a61b2b; background: #fff; color: #a61b2b; }
.actions .back-to-site { min-height: 2.8rem; padding: .65rem 1rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #2a2a2a; border-radius: .4rem; background: #fff; color: #2a2a2a; font-weight: 700; text-decoration: none; }
.form-message { min-height: 1.5rem; margin: 0; }
.preview { padding: 1.5rem; border-top: .4rem solid #d7263d; border-radius: .5rem; background: #f4f4f4; }
.preview h2 { margin: .4rem 0; }
.preview a { display: inline-block; margin-top: 1rem; padding: .7rem 1rem; border-radius: .4rem; background: #d7263d; color: #fff; text-decoration: none; font-weight: 700; }
.template-manager { padding-left: clamp(1.25rem, 2vw, 2rem); border-left: 2px solid #111; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.section-heading p { margin: .25rem 0 1rem; color: #555; }
.template-save { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .75rem; }
.template-save button, .template-action { border: 0; background: #2a2a2a; color: #fff; font-weight: 700; cursor: pointer; }
.template-save .primary { background: #d7263d; }
.template-list { display: grid; gap: .75rem; }
.template-empty { margin: 0; padding: 1rem; border: 1px dashed #aaa; border-radius: .5rem; color: #555; text-align: center; }
.template-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: start; padding: 1rem; border: 1px solid #d5d5d5; border-left: .3rem solid #d7263d; border-radius: .5rem; background: #fafafa; }
.template-card h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.template-card p { margin: .2rem 0 0; color: #666; font-size: .88rem; }
.template-card .template-saved-date { margin-top: .4rem; color: #777; font-size: .78rem; }
.template-status { align-self: start; min-width: 5.2rem; padding: .3rem .65rem; border-radius: 999px; color: #fff; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-align: center; }
.template-status.active { background: #24713b; }
.template-status.past { background: #6b3038; }
.template-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.template-action { min-height: 2.35rem; padding: .45rem .65rem; font-size: .88rem; }
.template-action.danger { border: 1px solid #a61b2b; background: #fff; color: #a61b2b; }
button:disabled { cursor: wait; opacity: .65; }
.form-message.error { color: #a61b2b; }
.form-message.success { color: #24713b; }

@media (max-width: 1050px) {
  .admin-panel { width: min(94%, 52rem); margin: 1rem auto; }
  .admin-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .template-manager { padding: 1.25rem 0 0; border-top: 2px solid #111; border-left: 0; }
}

@media (max-width: 620px) {
  .admin-panel { width: calc(100% - 1rem); padding: 1rem; }
  form { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .date-time-group { grid-template-columns: 1fr 1fr; }
  .actions > * { width: 100%; }
  .template-save { grid-template-columns: 1fr; }
  .template-card { grid-template-columns: minmax(0, 1fr) auto; }
  .template-actions { justify-content: stretch; }
  .template-action { flex: 1 1 calc(50% - .45rem); }
  header { align-items: flex-start; flex-direction: column; }
}
