:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #263238;
  --muted: #667085;
  --line: #d9dee8;
  --accent: #e66b98;
  --accent-deep: #97395d;
  --shadow: 0 18px 48px rgba(31, 42, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.auth-shell,
.portal-shell {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand,
.eyebrow,
.app-kicker {
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin: 8px 0 22px;
  font-size: 30px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--text);
}

input:focus {
  outline: 3px solid rgba(230, 107, 152, 0.18);
  border-color: var(--accent);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.ghost-button {
  background: #fff;
  color: var(--accent-deep);
  border: 1px solid var(--line);
}

.text-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--accent-deep);
  font-weight: 800;
  text-decoration: none;
}

.error,
.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.error {
  border: 1px solid #f0b5c8;
  background: #fff1f6;
  color: #9a2f55;
}

.notice {
  border: 1px solid #9ed7b5;
  background: #eefbf3;
  color: #237046;
}

.portal-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 32px 20px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.portal-header h1,
.portal-header p {
  margin: 0;
}

.account-box {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.app-card {
  min-height: 180px;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.app-card strong {
  font-size: 24px;
}

.app-card span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.scheduler-card {
  border-color: rgba(230, 107, 152, 0.4);
}

.harmony-card {
  border-color: rgba(125, 89, 181, 0.42);
}

.theme-card {
  border-color: rgba(35, 112, 70, 0.34);
}

.admin-card {
  border-color: rgba(57, 118, 207, 0.34);
}

.disabled {
  opacity: 0.62;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-deep);
  font-weight: 800;
  text-decoration: none;
}

.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  background: #f9fafc;
}

td {
  color: var(--text);
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.badge,
.self-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef1f6;
  color: #526071;
  font-size: 12px;
  font-weight: 900;
}

.badge.ok {
  background: #e8f7ef;
  color: #237046;
}

.badge.wait {
  background: #fff4d8;
  color: #8a5d00;
}

.badge.off {
  background: #f2f3f5;
  color: #707a86;
}

.badge.admin {
  background: #eaf2ff;
  color: #2763b2;
}

.self-tag {
  margin-left: 8px;
  background: #fff1f6;
  color: var(--accent-deep);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row form {
  margin: 0;
}

.action-row button {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 13px;
}

.danger-button {
  background: #b43b50;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.form-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.form-card h2,
.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.help-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.theme-list {
  display: grid;
}

.theme-block {
  border-bottom: 1px solid var(--line);
}

.theme-block:last-child {
  border-bottom: 0;
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
}

.theme-row form {
  margin: 0;
}

.history-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.empty-panel {
  margin: 0;
  padding: 22px;
  color: var(--muted);
}

.empty-inline {
  margin: 0;
  padding: 8px 20px 16px;
  color: var(--muted);
  font-size: 13px;
}

.icon-admin-list {
  display: grid;
  gap: 8px;
  padding: 0 20px 14px;
}

.icon-admin-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.icon-admin-row img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.icon-admin-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.icon-admin-row form {
  margin: 0;
}

.inline-icon-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 90px minmax(180px, 1.2fr) auto;
  gap: 8px;
  padding: 0 20px 20px;
}

.inline-icon-form input {
  min-width: 0;
}

.upload-panel {
  margin-top: 16px;
}

@media (max-width: 640px) {
  .portal-header,
  .account-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .split-layout,
  .form-grid,
  .inline-icon-form {
    grid-template-columns: 1fr;
  }
}
