[hidden] {
  display: none !important;
}
#portal {
  min-height: 100dvh;
  padding: 36px max(24px, 7vw);
  background: #0a0a0a;
  color: #f5f5f5;
}
.portal-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}
.portal-logo {
  width: 150px;
  display: block;
}
.portal-header > div {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.portal-header .button {
  color: #f5f5f5;
  border-color: #444;
  background: transparent;
}
.portal-intro {
  padding: 90px 0 50px;
}
.portal-intro h1 {
  font-size: clamp(64px, 10vw, 140px);
  letter-spacing: -.07em;
  line-height: 1;
  margin: 24px 0;
}
.portal-intro h1 span {
  color: #8e8e8e;
  font-weight: 200;
}
.portal-slogan {
  letter-spacing: .35em;
  font-size: 15px;
}
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.workspace-card {
  position: relative;
  display: block;
  padding: 32px;
  color: inherit;
  text-decoration: none;
  border: 1px solid #555;
  min-height: 260px;
  transition: background .2s;
}
.workspace-card:hover,
.workspace-card:focus-visible {
  background: #f5f5f5;
  color: #0a0a0a;
}
.workspace-card h2 {
  font-size: clamp(30px, 3vw, 48px);
  letter-spacing: -.04em;
  margin: 32px 0 10px;
}
.card-index {
  font-size: 11px;
  letter-spacing: .2em;
  color: #8e8e8e;
}
.card-arrow {
  display: block;
  margin-top: 30px;
}
.workspace-disabled {
  opacity: .45;
}
.portal-footer {
  margin-top: 70px;
  padding: 24px 0;
  border-top: 1px solid #444;
  display: flex;
  justify-content: space-between;
  color: #8e8e8e;
}
.production-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 4vw;
  border-bottom: 1px solid #ddd;
  flex-wrap: wrap;
}
.production-brand {
  font-weight: 700;
  letter-spacing: .12em;
}
.production-header nav {
  display: flex;
  flex-direction: row;
  margin: 0;
  min-width: 0;
  gap: 8px;
  flex-wrap: wrap;
}
.production-header nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.production-header a {
  text-decoration: none;
  color: #555;
  padding: 10px;
}
.production-header a[aria-current] {
  background: #0a0a0a;
  color: #f5f5f5;
}
.production-main {
  max-width: 1400px;
  margin: auto;
  padding: 32px 4vw;
}
.production-main h1 {
  font-size: clamp(30px, 4vw, 54px);
  letter-spacing: -.04em;
}
.production-main .panel {
  padding: 22px;
  margin: 20px 0;
}
.production-main .metrics {
  grid-template-columns: repeat(4, 1fr);
}
.os-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.os-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
.os-project-card {
  border: 1px solid #ddd;
  padding: 22px;
  color: inherit;
  text-decoration: none;
  background: white;
}
.os-project-card h3 {
  margin: 12px 0;
}
.os-project-card p {
  color: #666;
}
.os-dialog {
  width: min(720px, 94vw);
  max-height: 92dvh;
  padding: 26px;
  border: 1px solid #aaa;
}
.os-dialog::backdrop {
  background: #0009;
}
.os-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.os-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.os-form input,
.os-form select,
.os-form textarea,
.calendar-controls input,
.calendar-controls select {
  padding: 12px;
  border: 1px solid #bbb;
  background: #fff;
  min-width: 0;
  font: inherit;
}
.os-form textarea {
  min-height: 90px;
  resize: vertical;
}
.os-form .full {
  grid-column: 1/-1;
}
.os-dialog .os-actions {
  margin-top: 22px;
  justify-content: flex-end;
}
.os-error {
  color: #8c2929;
}
.os-status {
  min-height: 24px;
  margin-top: 12px;
}
.os-record {
  border-bottom: 1px solid #ddd;
  padding: 16px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.os-record p {
  color: #666;
  white-space: pre-wrap;
}
.os-record .tag {
  white-space: nowrap;
}
.os-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow: auto;
}
.os-board > section {
  background: #ededed;
  padding: 16px;
}
.os-board .os-record {
  background: white;
  padding: 16px;
  display: block;
  margin-bottom: 10px;
}
.os-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  border-left: 1px solid #ddd;
  border-top: 1px solid #ddd;
  min-width: 770px;
}
.os-day {
  min-height: 130px;
  border-right: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 10px;
}
.os-day time {
  font-size: 12px;
  color: #666;
}
.os-day a {
  display: block;
  font-size: 12px;
  margin-top: 8px;
  color: #0a0a0a;
}
.calendar-scroll {
  overflow: auto;
}
.calendar-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.os-detail {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.os-empty {
  padding: 25px;
  color: #666;
  border: 1px dashed #aaa;
}
.os-meta {
  font-size: 12px;
  color: #666;
}
.os-demo {
  padding: 10px 4vw;
  background: #e9e9e9;
  color: #222;
}
.production-main button,
.production-main a.button {
  min-height: 44px;
}
.production-main .task-filter {
  padding: 10px;
  font: inherit;
}
.os-record code {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.os-workspace-brief {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.os-activity {
  max-height: 350px;
  overflow: auto;
}
.os-linked {
  color: #222;
}
.production-main table {
  width: 100%;
}
@media (max-width: 700px) {
  #portal {
    padding: 24px 20px;
  }
  .portal-header {
    align-items: flex-start;
  }
  .portal-logo {
    width: 100px;
  }
  .portal-header > div {
    font-size: 11px;
    justify-content: flex-end;
    gap: 8px;
  }
  .portal-intro {
    padding: 60px 0 32px;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .workspace-card {
    min-height: 220px;
    padding: 24px;
  }
  .portal-footer {
    font-size: 11px;
    gap: 20px;
  }
  .production-header {
    padding: 16px;
  }
  .production-main {
    padding: 24px 16px;
  }
  .production-main .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .os-form,
  .os-workspace-brief {
    grid-template-columns: 1fr;
  }
  .os-dialog {
    padding: 18px;
  }
  .os-record {
    flex-direction: column;
  }
  .production-main .page-heading {
    display: block;
  }
  .production-main .metric strong {
    font-size: 30px;
  }
  .production-header > .os-actions {
    margin-left: auto;
    flex-wrap: wrap;
  }
  .production-header nav {
    order: 3;
    width: 100%;
    overflow: auto;
    flex-wrap: nowrap;
  }
  .production-header nav a {
    white-space: nowrap;
  }
  .os-actions .button {
    flex-grow: 1;
  }
  .os-board {
    grid-template-columns: repeat(4, 240px);
  }
}
/* 個人頭像僅使用受控JPEG縮圖；無照片時使用名字首字。 */
.profile-avatar{width:38px;height:38px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;background:#e6e6e6;color:#0a0a0a;overflow:hidden;flex-shrink:0;font-size:16px;line-height:1;vertical-align:middle}
.profile-avatar img{width:100%;height:100%;object-fit:cover}.profile-avatar-large{width:96px;height:96px;font-size:36px}.portal-user{display:flex;gap:12px;align-items:center;max-width:100%}.portal-user strong,.portal-user small{display:block;overflow-wrap:anywhere}.portal-user small{font-size:11px;color:#8e8e8e;margin-top:5px}.profile-photo-section{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:24px 0}.profile-photo-section p{width:100%;font-size:12px;color:#666}.profile-file{position:relative;overflow:hidden;cursor:pointer}.profile-file input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}.profile-dialog input,.profile-dialog textarea{font-size:16px}.profile-dialog [role=status]{min-height:24px;white-space:pre-wrap}.avatar .profile-avatar{width:100%;height:100%}
@media(max-width:700px){.portal-header>div{max-width:68%;min-width:0}.portal-user{gap:8px;width:100%}.portal-user>span:last-child{min-width:0}.profile-avatar{width:34px;height:34px}.profile-avatar-large{width:88px;height:88px}.profile-photo-section .button{min-height:44px}.profile-dialog .dialog-head{gap:12px}}

/* 手機入口：Logo 與頭像分居左右，帳號資訊與操作各自成列。 */
@media (max-width: 700px) {
  .portal-header {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 14px 12px;
  }
  .portal-header .portal-logo {
    grid-column: 1;
    grid-row: 1;
    width: 120px;
    max-width: 100%;
  }
  .portal-header > div,
  .portal-header .portal-user {
    display: contents;
  }
  .portal-header .portal-user > .profile-avatar {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 40px;
    height: 40px;
  }
  .portal-header .portal-user > span:last-child {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
  }
  .portal-header .portal-user strong {
    font-size: 16px;
    line-height: 1.4;
  }
  .portal-header .portal-user small {
    margin-top: 4px;
    line-height: 1.5;
  }
  .portal-header .button {
    grid-row: 3;
    width: 100%;
    min-height: 44px;
    margin: 0;
    justify-content: center;
  }
  .portal-header #os-settings { grid-column: 1; }
  .portal-header #os-logout { grid-column: 2; }
}

/* 統一成員管理沿用可捲動對話框與手機單欄表單。 */
.team-settings{width:min(860px,94vw);max-height:90dvh;overflow-y:auto}
.team-settings .panel{margin-top:20px;padding:20px;border:1px solid #ccc}
.team-settings p{line-height:1.7;overflow-wrap:anywhere}
.team-settings input,.team-settings select{font-size:16px}
.team-settings .button{min-height:44px}
.team-grant-list{max-height:220px;overflow:auto}
.portal-admin-actions{display:flex;justify-content:flex-end;margin-top:14px}

/* 手機製作導覽保持兩列；窄螢幕允許操作區獨立成列，避免擠壓文字。 */
@media (max-width: 700px) {
  .production-header { gap: 12px; }
  .production-header .production-brand { padding: 0; }
  .production-header > .os-actions { gap: 6px; }
  .production-header > .os-actions .button {
    min-height: 44px;
    padding: 10px 8px;
    font-size: 11px;
  }
  .production-header nav { scrollbar-width: none; }
  .production-header nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 700px) {
  .os-form input,
  .os-form select,
  .os-form textarea,
  .calendar-controls input,
  .calendar-controls select,
  .production-main .task-filter { font-size: 16px; }
}
