* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f7f9;
  color: #17202a;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.portal-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, auto) minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 42px);
  background: #ffffff;
  border-bottom: 1px solid #d8dee6;
}

.brand {
  color: #46616f;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-logo {
  display: block;
  width: min(100%, 180px);
  height: auto;
  margin-bottom: 4px;
}

.portal-header-brand {
  justify-self: start;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
}

.portal-customer-name {
  justify-self: center;
  max-width: min(48vw, 680px);
  text-align: center;
  overflow-wrap: anywhere;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.portal-nav a,
button {
  border: 1px solid #245a70;
  background: #245a70;
  color: #fff;
  border-radius: 6px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.portal-nav a:first-child {
  background: #fff;
  color: #245a70;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.portal-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px clamp(14px, 4vw, 32px) 44px;
}

.calendar-section {
  margin-bottom: 28px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.calendar-toolbar h2 {
  text-align: center;
  font-size: 1.2rem;
}

.calendar-toolbar button {
  aspect-ratio: 1;
  padding: 0;
  font-size: 1.4rem;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  color: #667481;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.calendar-weekdays span {
  padding: 6px 0;
}

.calendar-grid {
  overflow: hidden;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #dce2e8;
  gap: 1px;
}

.calendar-day {
  display: grid;
  align-content: space-between;
  min-height: 82px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #17202a;
  padding: 8px;
  text-align: left;
}

.calendar-day:hover,
.calendar-day:focus-visible {
  outline: 2px solid #245a70;
  outline-offset: -2px;
}

.calendar-day.is-muted {
  background: #f1f3f5;
  color: #9aa5af;
}

.calendar-day.is-today {
  background: #eef7f7;
}

.day-number {
  font-weight: 800;
}

.day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 20px;
}

.dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.dot-plate {
  background: #3d6f9f;
}

.dot-print {
  background: #2e7d6b;
}

.dot-delivery {
  background: #b86635;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 14px;
  color: #52616e;
  font-size: 0.86rem;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend .dot {
  min-width: 10px;
  width: 10px;
  height: 10px;
}

.day-panel {
  background: #fff;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  padding: 14px;
}

.day-panel h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.day-events {
  display: grid;
  gap: 8px;
}

.day-event {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-left: 5px solid #8a98a5;
  background: #f8fafb;
  border-radius: 6px;
  padding: 9px 10px;
}

.day-event.event-plate {
  border-left-color: #3d6f9f;
}

.day-event.event-print {
  border-left-color: #2e7d6b;
}

.day-event.event-delivery {
  border-left-color: #b86635;
}

.event-label {
  color: #52616e;
  font-size: 0.82rem;
  font-weight: 800;
}

.day-event p {
  margin-top: 2px;
}

.event-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.event-status {
  flex: 0 0 auto;
  border: 1px solid #9ca3af;
  background: #6b7280;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 9px;
}

.event-status.status-active {
  border-color: #2563eb;
  background: #3b82f6;
  color: #fff;
}

.event-status.status-done {
  border-color: #059669;
  background: #10b981;
  color: #fff;
}

.event-status.status-pending {
  border-color: #9ca3af;
  background: #6b7280;
  color: #fff;
}

.day-event small,
.empty-day {
  color: #667481;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar h2 {
  font-size: 1.15rem;
}

.message,
.alert,
.notice {
  padding: 12px 14px;
  background: #fff8df;
  border: 1px solid #ecd17b;
  border-radius: 6px;
  color: #67520b;
}

.notice {
  background: #eef8f3;
  border-color: #8fb2a1;
  color: #236048;
}

.orders {
  display: grid;
  gap: 12px;
}

.order-card {
  background: #fff;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  padding: 16px;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.order-no {
  color: #5d6b78;
  font-size: 0.82rem;
  font-weight: 700;
}

.order-card h3 {
  margin-top: 3px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.status {
  flex: 0 0 auto;
  border: 1px solid #8fb2a1;
  background: #eef8f3;
  border-radius: 999px;
  color: #236048;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
}

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

.meta div {
  min-width: 0;
}

.meta dt {
  color: #667481;
  font-size: 0.78rem;
  font-weight: 700;
}

.meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: #e3e8ee;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  background: #2e7d6b;
  border-radius: inherit;
}

.portal-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(100%, 380px);
  background: #fff;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  padding: 24px;
}

.login-logo {
  display: block;
  width: min(100%, 310px);
  height: auto;
  margin: 0 auto 18px;
}

.login-panel h1 {
  margin: 4px 0 18px;
}

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

.login-panel .alert,
.login-panel .notice {
  margin-bottom: 14px;
}

.form-help {
  margin-bottom: 14px;
  color: #52616e;
  font-size: 0.92rem;
  line-height: 1.5;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: #4a5865;
  font-weight: 700;
}

.login-panel input {
  width: 100%;
  border: 1px solid #b9c4cf;
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
}

.panel-link {
  margin-top: 16px;
  text-align: center;
}

.panel-link a {
  color: #245a70;
  font-weight: 700;
}

@media (max-width: 640px) {
  .portal-header,
  .toolbar,
  .order-head {
    align-items: stretch;
    display: flex;
    flex-direction: column;
  }

  .portal-header-brand,
  .portal-customer-name,
  .portal-nav {
    justify-self: auto;
  }

  .portal-customer-name {
    max-width: 100%;
    text-align: left;
  }

  .meta {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 58px;
    padding: 6px;
  }

  .day-event {
    grid-template-columns: 1fr;
  }

  .event-title-row {
    flex-direction: column;
  }

  .portal-nav,
  .toolbar button {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-nav a,
  .toolbar button {
    text-align: center;
    width: 100%;
  }
}
