:root {
  --ink: #10252e;
  --muted: #60717a;
  --line: #d6e4e7;
  --paper: #f5faf9;
  --white: #ffffff;
  --deep: #07313d;
  --water: #087b8d;
  --danger: #d6533c;
  --success: #237a54;
  --shadow: 0 18px 50px rgba(7, 49, 61, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: var(--paper);
}

a {
  color: var(--water);
  font-weight: 800;
  text-decoration: none;
}

.intern-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.intern-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: var(--white);
  background: var(--water);
  font-weight: 900;
}

.intern-brand strong,
.intern-brand small,
.intern-user span,
.intern-user small {
  display: block;
}

.intern-brand small,
.intern-user small,
.muted,
.page-heading p {
  color: var(--muted);
}

.intern-user {
  text-align: right;
}

.intern-user span {
  font-weight: 800;
}

.intern-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 76px);
}

.intern-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #eef7f6;
}

.intern-sidebar nav,
.sidebar-actions {
  display: grid;
  gap: 6px;
}

.intern-sidebar a {
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--deep);
}

.intern-sidebar a:hover,
.intern-sidebar a.active {
  background: var(--white);
}

.sidebar-actions {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.intern-main,
.login-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.login-main {
  display: grid;
  min-height: calc(100vh - 76px);
  place-items: center;
}

.login-panel {
  width: min(460px, 100%);
  padding: clamp(24px, 5vw, 38px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.page-heading {
  margin-bottom: 22px;
}

.split-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.compact-heading {
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--water);
  font-size: .82rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  max-width: 820px;
  font-size: clamp(2rem, 4.8vw, 3.8rem);
}

.panel,
.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(20px, 4vw, 32px);
}

.message {
  margin: 12px 0;
  padding: 14px 18px;
  font-weight: 800;
}

.success {
  color: var(--success);
}

.error {
  color: var(--danger);
}

.warning {
  color: #8a5b00;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-group {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-group > h2 {
  grid-column: 1 / -1;
}

.action-card {
  display: grid;
  gap: 10px;
}

.action-card span {
  color: var(--water);
  font-size: .8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.notice-panel {
  margin-bottom: 18px;
}

.list-panel {
  margin-top: 18px;
}

.notice-list {
  display: grid;
  gap: 10px;
}

.notice-item {
  display: grid;
  grid-template-columns: minmax(160px, .7fr) minmax(220px, 1fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.notice-item small {
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--deep);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-weight: 400;
}

input[type="checkbox"] {
  width: auto;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
}

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

.status-pill {
  align-self: start;
  justify-self: end;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--white);
  background: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.status-pill.success {
  background: var(--success);
}

.status-pill.warning {
  background: #b8751b;
}

.language-stack {
  display: grid;
  gap: 16px;
}

.language-panel {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.language-panel legend {
  padding: 0 8px;
  color: var(--water);
  font-weight: 900;
}

.html-help {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(214, 83, 60, .45);
  border-radius: 8px;
  color: var(--danger);
  background: #fff3f0;
}

.html-help p {
  margin: 0;
  color: var(--danger);
}

.html-help code {
  color: #8f2f20;
  font-weight: 800;
}

.danger-panel {
  margin-top: 18px;
}

.danger-button {
  background: var(--danger);
}

.password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.password-control input {
  min-width: 0;
}

.password-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--deep);
  background: #f0f7f7;
  font-size: 1.05rem;
  line-height: 1;
}

.password-toggle:hover {
  background: var(--white);
}

.field-grid,
.readonly-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.readonly-grid {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f7f7;
}

.readonly-grid span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.form-note {
  margin: -8px 0 0;
}

.login-panel .auth-form-link {
  margin-top: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: var(--white);
  background: var(--water);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button.danger {
  background: var(--danger);
}

.link-button {
  min-height: auto;
  padding: 0;
  color: var(--water);
  background: transparent;
}

.danger-link {
  color: var(--danger);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
}

.report-copy-panel p {
  margin: 0 0 8px;
}

.plain-report-table th,
.plain-report-table td {
  border: 1px solid var(--line);
  padding: 7px 8px;
}

.plain-report-table th {
  text-align: center;
}

.plain-report-table td:not(:first-child) {
  text-align: right;
}

.compact-data-table th,
.compact-data-table td {
  padding: 6px 8px;
  font-size: .84rem;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.intern-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.media-admin-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.media-preview {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #e5eff0;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.content-image-current {
  width: min(360px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e5eff0;
}

.content-image-current img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.zoomable-media {
  position: relative;
  width: 100%;
  height: 100%;
}

.zoom-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  color: var(--white);
  background: rgba(3, 22, 31, .72);
  font-size: 1.05rem;
  line-height: 1;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(3, 22, 31, .88);
}

.lightbox.open {
  display: grid;
}

.lightbox img {
  max-width: min(100%, 1180px);
  max-height: calc(100vh - 96px);
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  color: var(--white);
  background: rgba(3, 22, 31, .72);
  font-size: 1.5rem;
  line-height: 1;
}

.media-admin-body {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.media-admin-body span,
.status-row span {
  color: var(--water);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.meta-list {
  display: grid;
  gap: 4px;
  margin: 0;
}

.meta-list div,
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-list dt {
  color: var(--muted);
  font-weight: 800;
}

.meta-list dd {
  margin: 0;
}

.mail-editor-wrap,
.mail-recipient-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.mail-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f0f7f7;
}

.mail-toolbar button,
.mail-toolbar select,
.mail-toolbar input[type="color"] {
  width: auto;
  min-height: 34px;
}

.mail-toolbar button {
  min-width: 38px;
  padding: 0 10px;
}

.mail-toolbar input[type="color"] {
  width: 42px;
  padding: 3px;
}

.mail-editor {
  min-height: 260px;
  padding: 14px;
  outline: none;
}

.mail-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(8, 123, 141, .22);
}

.mail-editor-note {
  margin: 8px 10px 0;
  font-size: .9rem;
}

.mail-editor img {
  max-width: 100%;
  height: auto;
}

.mail-recipient-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 16px;
}

.mail-recipient-panel legend {
  padding: 0 8px;
  color: var(--water);
  font-weight: 900;
}

.mail-mode-panel {
  padding: 16px 18px;
}

.mail-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mail-mode-option {
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
  line-height: 1.35;
}

.mail-mode-option input[type="radio"] {
  width: auto;
  flex: 0 0 auto;
}

.recipient-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.recipient-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}

.mail-group-form {
  margin-top: 14px;
}

.mail-group-edit {
  margin-bottom: 10px;
}

.mail-group-edit summary {
  color: var(--water);
  font-weight: 900;
  cursor: pointer;
}

.mail-group-edit form {
  margin-top: 12px;
}

@media (max-width: 880px) {
  .intern-shell {
    grid-template-columns: 1fr;
  }

  .intern-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .intern-sidebar nav {
    display: flex;
    flex-wrap: wrap;
  }

  .dashboard-grid,
  .tool-group,
  .field-grid,
  .readonly-grid,
  .notice-item,
  .intern-media-grid,
    .media-admin-card,
  .recipient-grid {
    grid-template-columns: 1fr;
  }

  .mail-mode-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .intern-header,
  .split-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .intern-user {
    text-align: left;
  }
}
