/* Amo-like shell: LEFT icon rail + secondary left menu */
:root {
  --rail-w: 72px;
  --subrail-w: 176px;
  --rail-bg: #1e2330;
  --rail-fg: #9aa3b5;
  --rail-fg-active: #ffffff;
  --rail-active: rgb(194, 65, 12);
  --rail-hover: rgba(255, 255, 255, 0.06);
  --subrail-bg: #f3f1ed;
  --subrail-border: #e7e5e4;
  --bottom-h: 64px;
}

.app-shell {
  min-height: 100vh;
  background: rgb(250, 248, 245);
}

.app-shell__main {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 5.5rem;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .app-shell__main {
    padding: 1.5rem 1.5rem 2rem;
    padding-left: calc(var(--rail-w) + 1.5rem);
    max-width: none;
  }
}

/* ---- Primary rail: LEFT (desktop) / bottom (mobile) ---- */
.app-rail {
  position: fixed;
  z-index: 50;
  display: flex;
  background: var(--rail-bg);
  color: var(--rail-fg);
  box-shadow: 4px 0 24px rgba(15, 18, 28, 0.12);
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bottom-h);
  flex-direction: row;
  align-items: stretch;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

@media (min-width: 768px) {
  .app-rail {
    top: 0;
    right: auto;
    bottom: auto;
    width: var(--rail-w);
    height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 0 16px;
    border-top: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
  }
}

.app-rail__brand {
  display: none;
  width: 40px;
  height: 40px;
  margin: 4px 0 18px;
  border-radius: 12px;
  background: linear-gradient(145deg, #c2410c, #9a3412);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (min-width: 768px) {
  .app-rail__brand { display: flex; }
}

.app-rail__nav {
  display: flex;
  flex: 1;
  width: 100%;
  align-items: stretch;
  justify-content: space-around;
  gap: 2px;
}

@media (min-width: 768px) {
  .app-rail__nav {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0 8px;
  }
}

.app-rail__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  flex: 1;
  max-width: 96px;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

@media (min-width: 768px) {
  .app-rail__item {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    padding: 10px 4px;
  }
}

.app-rail__item:hover {
  background: var(--rail-hover);
  color: #e8ecf4;
}

.app-rail__item.is-active {
  color: var(--rail-fg-active);
  background: rgba(194, 65, 12, 0.22);
}

.app-rail__item.is-active .app-rail__ico {
  color: #fdba74;
}

.app-rail__ico {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.app-rail__label {
  font-size: 0.65rem;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.app-rail__spacer {
  display: none;
  flex: 1;
}

@media (min-width: 768px) {
  .app-rail__spacer { display: block; }
}

.app-rail__logout {
  color: #8b93a7;
}

/* ---- Secondary left menu (bot / card sections) ---- */
.app-with-sub {
  position: relative;
  min-height: 60vh;
}

.app-subrail {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px;
  margin: 0 0 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--subrail-border);
}

.app-subrail::-webkit-scrollbar { display: none; }

@media (min-width: 768px) {
  .app-with-sub {
    margin-left: 0;
  }

  .app-subrail {
    position: fixed;
    z-index: 40;
    top: 0;
    left: var(--rail-w);
    width: var(--subrail-w);
    height: 100vh;
    margin: 0;
    padding: 18px 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 0;
    border: 0;
    border-right: 1px solid var(--subrail-border);
    background: var(--subrail-bg);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.02);
  }

  .app-with-sub__body {
    padding-left: calc(var(--subrail-w) + 0.25rem);
    max-width: 56rem;
  }
}

.app-subrail__title {
  display: none;
  padding: 4px 10px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a8a29e;
}

@media (min-width: 768px) {
  .app-subrail__title { display: block; }
}

.app-subrail__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 68px;
  padding: 10px 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #78716c;
  cursor: pointer;
  font: inherit;
  flex-shrink: 0;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

@media (min-width: 768px) {
  .app-subrail__item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
  }
}

.app-subrail__item:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #44403c;
}

@media (min-width: 768px) {
  .app-subrail__item:hover {
    background: rgba(255, 255, 255, 0.85);
  }
}

.app-subrail__item.is-active {
  background: rgb(194, 65, 12);
  color: #fff;
}

.app-subrail__ico {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.app-subrail__label {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 76px;
}

@media (min-width: 768px) {
  .app-subrail__label {
    font-size: 0.82rem;
    text-align: left;
    max-width: none;
  }
}

/* legacy sec-tabs → map to subrail look if any remain */
.sec-tabs { display: none; }
