:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #eef3ec;
  --line: #dce3d8;
  --line-strong: #c6d0c2;
  --text: #102019;
  --muted: #5f6f66;
  --primary: #176b55;
  --primary-dark: #115140;
  --danger: #b3261e;
  --radius: 6px;
}

/* Platform project list: keep long SMTP messages readable and action buttons aligned. */
.sys-admin .alert {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  margin: 0 0 16px;
  padding: 8px 10px;
  border: 1px solid rgba(155, 52, 24, 0.16);
  border-radius: var(--radius);
  background: rgba(155, 52, 24, 0.055);
  font-size: 13px;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sys-admin td.project-actions {
  min-width: 640px;
}

.sys-admin .project-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: start;
  gap: 8px;
  overflow-x: auto;
  padding-block: 2px;
}

.sys-admin .project-actions form.inline {
  display: inline-flex;
  margin: 0;
  flex: 0 0 auto;
}

.sys-admin .project-actions a,
.sys-admin .project-actions button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 9px;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.sys-admin .project-actions a {
  align-self: center;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft JhengHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16, 32, 25, 0.02);
}

header strong {
  white-space: nowrap;
  letter-spacing: 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
}

nav a {
  color: #17604e;
  line-height: 1.8;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 44px;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

h1 {
  margin: 0 0 22px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
}

h2 {
  margin-top: 0;
  font-size: 18px;
}

form {
  display: grid;
  gap: 14px;
  max-width: 820px;
  margin: 0 0 22px;
}

form.inline {
  display: inline-flex;
  max-width: none;
  margin: 0 0 0 6px;
  gap: 0;
  vertical-align: middle;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
  max-width: none;
}

.toolbar label {
  min-width: 150px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
}

form:not(.toolbar):not(.inline) > label {
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

form:not(.toolbar):not(.inline) > label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 120px;
}

form:not(.toolbar):not(.inline) > button,
form:not(.toolbar):not(.inline) > .button {
  margin-left: 132px;
}

fieldset {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 2px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}

fieldset label {
  display: grid;
  grid-template-columns: 120px auto;
  align-items: center;
  justify-content: start;
  gap: 12px;
  min-height: 34px;
}

fieldset label input[type="checkbox"] {
  order: 2;
}

fieldset label {
  color: var(--text);
}

input,
select,
textarea,
button,
.button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
}

textarea {
  min-height: 210px;
  resize: vertical;
  line-height: 1.55;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  accent-color: var(--primary);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(23, 107, 85, 0.18);
  border-color: var(--primary);
}

form:not(.toolbar):not(.inline) > label.textarea-label,
fieldset label.textarea-label {
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: start;
}

select option {
  background: #ffffff;
  color: #12201b;
}

select option:checked {
  background: var(--primary);
  color: #ffffff;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  white-space: nowrap;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
}

button:disabled,
.button.disabled {
  cursor: not-allowed;
  opacity: .55;
  background: var(--muted);
  border-color: var(--muted);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.hint {
  color: var(--muted);
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
}

th,
td {
  height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid #e6ebe3;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: #11251d;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

td button,
td .button {
  min-height: 32px;
  padding: 5px 10px;
}

td form.inline + form.inline {
  margin-left: 4px;
}

td.project-actions {
  min-width: 390px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.project-actions form.inline {
  margin: 0;
}

.project-actions a,
.project-actions form.inline,
.project-actions button {
  flex: 0 0 auto;
}

.alert {
  min-height: 22px;
  margin: 0 0 14px;
  color: #9b3418;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.proj-hero-preview {
  display: block;
  width: min(100%, 520px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.image-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.image-upload-row input[type="file"] {
  width: auto;
  flex: 1 1 260px;
}

.image-upload-row .button {
  min-width: 104px;
}

.proj-hero-preview.new-preview {
  margin-top: 8px;
  border-color: var(--primary);
}

.login-register-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  max-width: 820px;
  margin: 0 0 18px;
}

.login-register-cta p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.login-register-cta .button {
  min-width: 86px;
}

.login-register-cta .cta-action {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.login-test-note {
  margin-left: 120px;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

.forgot-password-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  max-width: 820px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.forgot-password-cta span {
  text-align: right;
}

.forgot-password-cta button {
  min-height: 36px;
  padding: 6px 14px;
  min-width: 86px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.grid > div {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.na { color: var(--danger); font-weight: 700; }
.op { color: #08723f; font-weight: 700; }
.ca { color: #69746e; font-weight: 700; }

.sys-admin {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #e8eef2;
  --line: #d8e1e6;
  --line-strong: #c4d1d8;
  --text: #17262c;
  --muted: #61727a;
  --primary: #2f6473;
  --primary-dark: #254f5d;
  background:
    linear-gradient(180deg, rgba(244, 247, 249, 0.96), rgba(237, 243, 246, 0.98)),
    var(--bg);
}

.sys-admin header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: var(--line);
  box-shadow: 0 10px 28px rgba(47, 100, 115, 0.08);
}

.sys-admin nav a,
.sys-admin a {
  color: var(--primary);
}

.sys-admin .button,
.sys-admin button {
  color: #fff;
}

.sys-admin h1,
.sys-admin h2,
.sys-admin label,
.sys-admin th {
  color: var(--text);
}

.sys-admin input,
.sys-admin select,
.sys-admin textarea {
  border-color: var(--line-strong);
}

.sys-admin input:focus,
.sys-admin select:focus,
.sys-admin textarea:focus {
  outline-color: rgba(47, 100, 115, 0.18);
  border-color: var(--primary);
}

.sys-admin table,
.sys-admin .grid > div {
  box-shadow: 0 10px 28px rgba(47, 100, 115, 0.06);
}

.proj-admin {
  --bg: #151a18;
  --surface: #202723;
  --surface-soft: #27322d;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef3ee;
  --muted: #aeb9b1;
  --primary: #4e9b82;
  --primary-dark: #3f806b;
  --danger: #ff8f7d;
  background:
    radial-gradient(circle at top left, rgba(78, 155, 130, 0.16), transparent 28rem),
    var(--bg);
}

.proj-admin header {
  background: rgba(25, 31, 28, 0.96);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
}

.proj-admin nav a,
.proj-admin a {
  color: #8fd2bd;
}

.proj-admin .button,
.proj-admin button {
  color: #fff;
}

.proj-admin h1,
.proj-admin h2,
.proj-admin label,
.proj-admin fieldset label,
.proj-admin th {
  color: var(--text);
}

.proj-admin input,
.proj-admin select,
.proj-admin textarea {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
  color: var(--text);
}

.proj-admin input:focus,
.proj-admin select:focus,
.proj-admin textarea:focus {
  outline-color: rgba(78, 155, 130, 0.28);
  border-color: var(--primary);
}

.proj-admin fieldset,
.proj-admin .grid > div {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line-strong);
}

.proj-admin table {
  background: var(--surface);
  border-color: var(--line);
}

.proj-admin th {
  background: var(--surface-soft);
}

.proj-admin td {
  border-bottom-color: var(--line);
}

.proj-admin .muted,
.proj-admin legend,
.proj-admin .ca {
  color: var(--muted);
}

.proj-admin .op {
  color: #8fd2a5;
}

.proj-admin .alert,
.proj-admin .na {
  color: #ff9d86;
}

.monthly-overview {
  max-width: 1180px;
}

.monthly-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.studio-name {
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.month-title {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 900;
}

.month-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 800;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
}

.calendar-legend i {
  width: 18px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
}

.legend-normal {
  background: rgba(255, 255, 255, 0.05);
}

.legend-special {
  background: rgba(245, 184, 65, 0.2);
}

.legend-closed {
  background: rgba(231, 83, 83, 0.18);
}

.legend-today {
  background: transparent;
  border-color: #8fd2bd !important;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.calendar-weekday {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
  font-size: clamp(1.45rem, 2.2vw, 2.35rem);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-weekday.sun {
  color: #ff8d8d;
}

.calendar-weekday.sat {
  color: #81b7ff;
}

.calendar-day {
  min-height: 142px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.calendar-day:nth-child(7n + 7),
.calendar-weekday:nth-child(7n) {
  border-right: 0;
}

.calendar-date {
  color: var(--text);
  font-weight: 900;
  font-size: clamp(1.55rem, 2.4vw, 2.6rem);
  line-height: 1;
  margin-bottom: 10px;
}

.outside-month {
  opacity: .45;
}

.weekend {
  background: rgba(231, 83, 83, 0.07);
}

.special-day {
  background: rgba(245, 184, 65, 0.15);
}

.closed-day {
  background: rgba(231, 83, 83, 0.14);
}

.today {
  box-shadow: inset 0 0 0 2px #8fd2bd;
}

.calendar-slots {
  display: grid;
  gap: 7px;
}

.calendar-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.slot-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  border-radius: 5px;
  font-weight: 900;
}

.slot-01 {
  color: #1f9f5d;
  background: rgba(75, 210, 132, 0.14);
}

.slot-02 {
  color: #46a8ff;
  background: rgba(70, 168, 255, 0.14);
}

.slot-03 {
  color: #d684ff;
  background: rgba(214, 132, 255, 0.14);
}

.calendar-slot.full,
.calendar-slot.full b {
  color: #ff6969;
  border-color: rgba(255, 105, 105, 0.45);
}

.waiting-count {
  color: #ff6969;
  font-weight: 900;
}

.closed-label {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff8d8d;
  font-weight: 900;
  font-size: 1.05rem;
}

.monthly-note {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
}

@media (max-width: 720px) {
  header {
    align-items: flex-start;
    padding: 12px 16px;
  }

  main {
    padding: 20px 14px 36px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar label,
  .toolbar button,
  .toolbar .button {
    width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .monthly-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(104px, 1fr));
    overflow-x: auto;
  }

  .login-register-cta {
    grid-template-columns: 1fr;
  }

  .login-register-cta p {
    text-align: left;
  }
}

@media (max-width: 359px) {
  form:not(.toolbar):not(.inline) > label,
  fieldset label {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  form:not(.toolbar):not(.inline) > label:has(input[type="checkbox"]),
  form:not(.toolbar):not(.inline) > button,
  form:not(.toolbar):not(.inline) > .button {
    margin-left: 0;
  }

  .login-test-note {
    margin-left: 0;
  }

  fieldset label input[type="checkbox"] {
    order: 0;
  }
}
.login-register-cta,
.forgot-password-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 1rem;
    row-gap: .65rem;
    width: 100%;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.login-register-cta .button,
.login-register-cta button,
.login-register-cta a.button,
.forgot-password-cta .button,
.forgot-password-cta button,
.forgot-password-cta a.button {
    justify-self: end;
    min-width: 78px;
    text-align: center;
    white-space: nowrap;
}

.login-register-cta .cta-action {
    display: grid;
    justify-items: end;
    gap: .35rem;
    min-width: 0;
}

.login-register-cta .cta-action span {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.45;
    text-align: right;
}

.login-test-note {
    margin-left: 120px;
    color: var(--muted);
    font-weight: 700;
}

.login-register-cta > :first-child,
.forgot-password-cta > :first-child {
    min-width: 0;
    line-height: 1.65;
}

@media (max-width: 420px) {
    .login-register-cta,
    .forgot-password-cta {
        grid-template-columns: 1fr auto;
        column-gap: .75rem;
        font-size: .92rem;
    }
}

@media (max-width: 340px) {
    .login-register-cta,
    .forgot-password-cta {
        grid-template-columns: 1fr;
    }

    .login-register-cta .button,
    .login-register-cta button,
    .login-register-cta a.button,
    .forgot-password-cta .button,
    .forgot-password-cta button,
    .forgot-password-cta a.button {
        justify-self: start;
    }

    .login-register-cta .cta-action {
        justify-items: start;
    }

    .login-register-cta .cta-action span {
        text-align: left;
    }

    .login-test-note {
        margin-left: 0;
    }
}
button,
.button,
a.button,
input[type="submit"],
input[type="button"] {
    min-height: 36px;
    font-size: .92rem;
    line-height: 1.25;
    padding: .45rem .7rem;
}

td button,
td .button,
td a.button,
td input[type="submit"],
td input[type="button"],
.project-actions button,
.project-actions .button,
.project-actions a.button {
    min-height: 32px;
    font-size: .84rem;
    padding: .34rem .52rem;
}
